Monday, February 15, 2010

exec() vs system()

Besides all the descriptions from PHP manual, let us do a small test. Create a file called test.php:
echo 'hello';

Create another file called runexec.php:
exec('php test.php');

Create a runsystem.php:
system('php test.php');

All three files are located in the same directory. I found runexec.php cannot call test.php properly. I must use full path in the exec command. However, runsystem.php can work very well.

No comments: