I am writing a webpage with an upload feature that allows me to upload a file and run a script to act on uploaded file. I have the script working to act on a file, as well as the upload working to get the file in a specified folder. The script is python and I am using an HTML form with a PHP script for the file uploading. I just want to be able to watch the directory for changes then act on any changes that occur. I looked here but I would rather have a trigger on change immediately than poll the directory every X seconds.
The file upload script is basically a copy-paste of this and my python file takes in the file name as a command line argument and creates an output file in the same directory.
EDIT: as mentioned in the comments I tried triggering the python script with php shell_exec()
and exec()
but neither have been working. For testing purposes, I ran chmod 777-R
on both the working directory and the directory with the input files I want to run and I get a return of 1
when running is_null($output)
on my command when trying to run the script.
What's confusing me is when i run the command ls /directory/to/work/from/
I get a return when I echo $output
and NULL
isn't returned. Why does ls
work but my python script not?
I suppose I should add for clarification I have run the exact python script from my terminal and it works perfectly.