I'm using an ajax call to execute "shell_exec" on the server (centos). The line that I'm executing is the following
echo shell_exec("php -q /websockets/timedactions.php");
This is the server response:
X-Powered-By: PHP/5.5.16
Access-Control-Allow-Origin: http://myIpAddress
Access-Control-Allow-Credentials: true
Content-type: text/html
After running this command it seems that the process that it supposed to activate is not running.
Calling the same command on shell with root access
php -q /websockets/timedactions.php
works perfectly.
How can I make the script work using shell_exec ?
more info:
ps aux | grep httpd | awk '{print $1}' = nobody
sestatus|grep enforcing = {no result}
file permissions -rwxr-xr-x 1 root root
ls -lZ timedactions.php -rwxr-xr-x root root ? timedactions.php*
www-data
or whatever your webserver's user name is. Does that user have access to the file? Does the script depend on any specific variables? Do you have any errors in your log file? – terdon Oct 06 '14 at 13:38nobody
and they don't have permissions to execute the script. What happens if you trysudo -u nobody php -q /websockets/timedactions.php
? – terdon Oct 06 '14 at 14:35