executing a shell script from a php file
i have a php file from which i need to call a开发者_开发技巧 shell script which i am doing as follows:
$out = exec("/root/.mozilla/firefox/score.sh 2>&1");
echo $out;
when i execute this code in opera its giving Permission denied. I have given permission to all directory and the script also.
is the problem because of that .mozilla file?? how to solve?? also tried with shell_exec().. not working
Have you given the web server user write/execute permissions?:
For example (assuming your web server user is apache belonging to group apache):
sudo chown apache:apache /root/.mozilla/firefox/score.sh
sudo chmod -R 744 /root/.mozilla/firefox/score.sh
Ensure that the webuser has permission to access all directories leading up to /root/.mozilla/firefox/
. Ideally, you'd move this script someplace else than root
's homedir.
精彩评论