PHP -> python seems to not work on web server
I have a few pages (one html, one php, and one python script) that takes a user input, and then outputs a pdf file (using reportlab) for the user. When I test on apache (localhost), it works perfectly. However, online on a real web host it is not working. The version of PHP on the web server is 5.2.17 and python is inst开发者_运维知识库alled.
Could the version be an issue? I am very lost because I'm not very experienced and it works perfectly on Apache and not at all on the internet.
Last thing, the command I use to call the python function from php is this:
$ed = exec("python pdfgeneration2.py $name $age");
I also thought maybe there is a better command for this?
My question may be vague and unclear but if anyone has any ideas it would be greatly appreciated.
Look at /var/logs/httpd/error_log, or wherever your distro's apache stores logs. Odds are you'll find an error message there from PHP.
In addition to checking the path like sberry recommended, double check perms, too. Apache will need execute permissions on the python script:
chown apache:apache pdfgeneration2.py
精彩评论