nima nima - 1 year ago 70
PHP Question

how ca I get variable from ubuntu and insert it to the php file

I have a php file and I want get exact variable from ubuntu command line

how can I do it?

Answer Source

Probably, you want to pass the arguments from the command line as follows:

php /path/to/www/path/to/script.php arg1 arg2

In PHP script, you can access the variables as follows.

// $argv[0] is '/path/to/wwwpublic/path/to/script.php'
$argument1 = $argv[1];
$argument2 = $argv[2];

Please let me know your thoughts.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download