I have a PHP script which calls a python script. The Python script does a simple write to file function.
Python:
f = open("xxx", "w")
f.write("xxxxxx")
f.close
PHP:
$output = system("python /home/xxxx/training/scripts/load.py);
echo $output;
If I run the Python directly, it is able to create and write to the file. But when I use the PHP to call it, no file will be created and written. Is that because of some system path related issue? How to fix it?
p.s. If I run a "whoami", it shows the user as "apache". Is that the possible reason that the write-to-file failed?
Thanks so much!