su03
su03

Reputation: 225

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

Upvotes: 1

Views: 6864

Answers (2)

Tash Pemhiwa
Tash Pemhiwa

Reputation: 7685

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

Upvotes: 1

Lightness Races in Orbit
Lightness Races in Orbit

Reputation: 385395

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.

Upvotes: 1

Related Questions