Calling python from a php script

This is the place for queries that don't fit in any of the other categories.

Calling python from a php script

Postby fbartolom » Wed Feb 05, 2014 4:45 pm

I need to call a simple python script from a php program. And I use the following piece of code to execute it:
Code: Select all
      $pythonCommand="/opt/python3/bin/python3 $palina";
      //echo "command=$pythonCommand result=$result";
      $resultData = json_decode($result, true);

the python code itself is very simple.
Yet when I run the python script from the command line it is very fast, while if I execute it from inside the php script, the php script gets extremely slow. In one server it even retuns without waiting the python scripts to complete.
The examples are on Debian and CentOS:
Any idea about what it might be and how to fix it?

Posts: 15
Joined: Tue Jan 28, 2014 9:30 am

Re: Calling python from a php script

Postby stranac » Wed Feb 05, 2014 6:24 pm

Sounds like a php problem to me...
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
Posts: 1790
Joined: Thu Feb 07, 2013 3:42 pm

Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 6 guests