I have a basic PHP script like this:
<?php
system("/bin/touch /root/testfile");
When I run this PHP script from the command line:
# php myscript.php
I get this:
sh: /touch: No such file or directory
Also, touch is in the right place:
# which touch
/bin/touch
Is there something I need to setup in my PHP script regarding paths? Because it can’t find touch (even though I specifically call it with its absolute path).
UPDATE
Running /bin/touch /root/testfile from the command line works properly as expected.
Also, touch isn’t working, yes, but other things are not working as well, such as sendmail. I’m simply using touch as an example in this question to keep it simple.
The PHP safe_mode is probably enable. You have to turn it off in your /etc/php.ini file.