I have a working shell script using killall to kill all instances of a program like below:
killall abc
Now, I write a php webpage to execute this script using shell_exec function:
shell_exec('sh ./myscript.sh');
Problem is that my php code works correct on commandline with "php myscript.php", but not works in browsers!. However, I know that the user in commandline is "root" and in php is "apache" (I get this with 'whoami'). The linux distribution is Centos 6 which uses SElinux. I changed the status of selinux to permissive.
Things I've checked:
- PHP safe_mode is off
- shell_exec() is not present in disable_functions in php.ini
Is there a way to run scripts with kill command using php?
Thank you for your help.
error_reportinganddisplay_errors)? what is the exit code of executed command (useexec()to findout)? do you have permission tokillthe target process? - Ariyan