apache php - executing commands using system(), problems
I sure that there's going to be a quick answer to this. I'm calling a command through the system() function in php.
PHP Code:
Code:
sam@nugget:/$ ls -la /usr/bin/tide | grep tide Thanks in advance for any help |
One thing is wrong dor sure: When using single quotes (' '), as you did, the variable $output will not be replaced with the value of $output. Use double quotes (" ") instead.
Also, what is the value of $output? Can www-data really write there? You can Check with this: $cmd = "tide -ml -fh -o $output 2>&1"; Any errors from the 'tide' program will show in you browser. I noticed 'tide' outputs html code. You could also try without the -o $output part first. The html from 'tide' will show nicely in the browser. Complete example: PHP Code:
|
Late night silly mistake...
Thanks for your reply Hko - and your simple script help pin down my silly mistake quickly. Apache was unable to write to the $output file which I was soon able to see with '2>&1'. The single/double quote issue was just a typo in the post.
Thanks again |
Just a note in general: If you run any system commands in PHP be prepared for time-out problems if the operations takes long to finish. Fore example, calling ghostscript to merge a set of PDF files can take longer than the web server allows the PHP process to run. This is often a problem with osCommerce modules.
Linux Archive |
All times are GMT -5. The time now is 01:05 AM. |