Execute symfony task command from the shell_exec() permission denied

送分小仙女□ 提交于 2019-12-13 04:58:40

问题


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/www is in /var
  • /var/www/esm is in /var/www
  • /var/www/esm/symfony is 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!