I want to send some data from php to that python script run the script and return the result to php. How would I do that? how can I even run python online without a framework or a python server.
Asked
Active
Viewed 766 times
0
-
2Many web hosts nowadays provide both python and php preinstalled. Since you're already able to run php, you might want to check and see if python can be run on the same server. – abought Aug 14 '12 at 11:45
-
And if Python can't be run on the same server, you should probably look for a different web host anyway. – David Robinson Aug 14 '12 at 11:58
2 Answers
1
Try using exec PHP function: http://php.net/manual/es/function.exec.php
Also, if you use Apache web server you'll have to ensure that the "Safe mode" of yout server is deactivated.

mvillaress
- 489
- 3
- 6
0
It depends on whether you can install Python on your server or not. If yes, call it using the exec function as mvillaress suggested (also see this thread). If you don't have Python installed and can't install it, then there's not much you can do. There are online interpreters like Ideone, but I think that calling them programmatically might be considered abuse.

Community
- 1
- 1

ondra.cifka
- 755
- 1
- 9
- 17