从shell_exec()权限执行symfony任务命令 [英] Execute symfony task command from the shell_exec() permission denied

查看:136
本文介绍了从shell_exec()权限执行symfony任务命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有symfony任务调用"doNothing",并且我想通过执行shell_exec('/var/www/esm/symfony php symfony doNothing');来执行它

I have symfony task call "doNothing" and i want to execute it from executing shell_exec('/var/www/esm/symfony php symfony doNothing');

通过调用我的symfony动作

by calling to my symfony action

apache错误,显示权限被拒绝.

apache error saying permission denied.

我认为www-data用户没有权限,我该如何解决?

i think www-data user dont have permission how could i resolved this?

已编辑

error is

sh:/var/www/esm/symfony:权限被拒绝

sh: /var/www/esm/symfony: permission denied

推荐答案

您应该查看脚本所在的目录.

You should look in the directory where your script is.

使用ls -la显示文件夹中的所有文件及其权限(要执行php脚本文件,必须至少将x位分配给www-data或其组).

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).

所有直到/的父目录都必须为用户/组分配x位,以便apache能够将目录更改为.

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

因此www数据用户应该能够执行(x位)所有这些目录.

So www-data user should have the ability to Execute (x bit) all of that directories.

因此,在/中执行ls -l并查看/var具有www数据用户或其所属组(drw x rw x ---)的x位时,它拥有此目录.在/var中执行ls -l等等...

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...

您可以将每个目录的权限更改为777.但是请勿使用-R键.只需将权限更改为仅目录.

You can change permissions to 777 for every directory. But DO NOT use -R key. Just change permissions to the directory only.

这篇关于从shell_exec()权限执行symfony任务命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆