I have a PHP script that is supposed to execute a python script as user "apache" but is returning the error:
/transform/anaconda/bin/python: can't open file '/transform/python_code/edit_doc_with_new_demo_info.py': [Errno 13] Permission denied
Permissions for edit_doc_with_new_demo_info.py are ---xrwx--x. 1 apache PosixUsers 4077 Sep 18 12:14 edit_doc_with_new_demo_info.py. The line that is calling this python script is:
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')
If apache is the owner of the python file and the owner has execute permission how can it be unable to open the file?
2 Answers 2
The Python interpreter has to open the file for reading, so both the execute and read bits are required. Try this:
$ chmod 550 /transform/python_code/edit_doc_with_new_demo_info.py
3 Comments
You need read permission to run the python script.
Comments
Explore related questions
See similar questions with these tags.