My default Web-Application is based on PHP. However, for easiness, I have built a python script that does some analysis. Now I need the php to call the python code and retri
Did you try running /usr/bin/python /var/www/include/sCrape.py -u '$my_url'
in a shell? The mistake is probably there.
Try:
$cmd = "/usr/bin/python /var/www/include/sCrape.py -u '$my_url' 2>&1";
$response = shell_exec($cmd);
echo $response;
This should output an error message.
shell_exec
only returns output from the standard output (stdout), if an error occurs it's written "to the" standard error (stderr). 2>&1
redirects stderr to stdout. See In the shell, what does “ 2>&1 ” mean?.
You may want to add #!/usr/bin/env python
on the first line of your python script and make it executable chmod +x /var/www/include/sCrape.py
. Afterwards you should be able to run your script without explicitly calling python. /var/www/include/sCrape.py -u '$my_url'