问题
I have symfony task call "doNothing" and i want to execute it from executing shell_exec('/var/www/esm/symfony php symfony doNothing');
by calling to my symfony action
apache error saying permission denied.
i think www-data user dont have permission how could i resolved this?
Edited
error is
sh: /var/www/esm/symfony: permission denied
回答1:
You should look in the directory where your script is.
Use ls -la to show all files in the folder and their permissions (to execute php script file must have at least x bit assigned to www-data or its group).
Also all the parent directories up to / MUST have x bit assigned to user/group for apache to be able to change directory to.
Look. You have Tree structured Files system:
/var/wwwis in/var/var/www/esmis in/var/www/var/www/esm/symfonyis in/var/www/esm
So www-data user should have the ability to Execute (x bit) all of that directories.
So when in / execute ls -l and look wheter /var has x bit for www-data user or it's group (drwxrwx---) and it owns this directory. When in /var execute ls -l an so on...
You can change permissions to 777 for every directory. But DO NOT use -R key. Just change permissions to the directory only.
来源:https://stackoverflow.com/questions/7281757/execute-symfony-task-command-from-the-shell-exec-permission-denied