I have a python file that I would want to execute whenever a php page is called. The python file is in the same folder as the php file. The python script on execution edits a textfile that the php file accesses.
I have the following code:
<?php
exec("python somefile.py",$output);
$file = fopen("test.txt",'r');
....
For some reason, the python script never gets executed. I know this certainly as I can see it from the changes in the text file. Since I was not sure if the script was made executable, so I included "python" on the command. I also ran:
chmod +x somefile.py
just to make sure this was not the reason. But this did not help too. What should I change to make the php page execute the python script whenever it is called?
exec()? Many times you'll find it in disabled functions for php./usr/bin/python ...?$PATHmay not being available in web server environmentini_set('display_errors', 1);goes to the first line of the php script. reload the page, what are you seeing?