I'm executing a php shell script from within a php webpage using exec().. I am sending this php shell script some arguments that I access using the array $argv ($argv[0],$argv[1],etc). The shell script has:
[FONT=courier new]
#!/usr/bin/php -q
[/FONT]
at the top. Now as far as I know, the -q is to suppress HTTP headers, but it returns this output (when the php webpage executes it):
[FONT=courier new]
X-Powered-By: PHP/4.2.1
Content-type: text/html
No input file specified.
[/FONT]
Note that the headers are still there. When I remove the -q it returns this:
[FONT=courier new]
X-Powered-By: PHP/4.2.1
Content-type: text/html
Warning: Division by zero in /path/to/shell/script/file on line 63
[/FONT]
This is because NOW it's not getting the $argv vars (Still executed by the php webpage)...BUT... when I make the php webpage echo the command and all it's arguments (that I pass to the exec() function), copy it out and paste/execute it in the shell, the php shell script executes fine, with the -q (surpressing headers) or without the -q (showing headers)... no errors.. picking up ALL the arguments sent??
The webpage executes the shell script, but its like the arguments don't get sent without the -q, and with it, it just says: "No input file specified"... and executed from within a shell, all works fine??
what to do, what to do 😕