G W*_*ner 2 php python apache permission-denied
我有一个PHP脚本应该以用户"apache"执行python脚本但是返回错误:
/transform/anaconda/bin/python: can't open file '/transform/python_code/edit_doc_with_new_demo_info.py': [Errno 13] Permission denied
对于权限edit_doc_with_new_demo_info.py的---xrwx--x. 1 apache PosixUsers 4077 Sep 18 12:14 edit_doc_with_new_demo_info.py.调用此python脚本的行是:
shell_exec('/transform/anaconda/bin/python /transform/python_code/edit_doc_with_new_demo_info.py ' . escapeshellarg($json_python_data) .' >> /transform/edit_subject_python.log 2>&1')
如果apache是python文件的所有者并且所有者具有执行权限,那么它怎么能无法打开文件?
Python解释器必须打开文件进行读取,因此执行和读取位都是必需的.试试这个:
$ chmod 550 /transform/python_code/edit_doc_with_new_demo_info.py
Run Code Online (Sandbox Code Playgroud)