Can I simply execute the Python program using PHP like this? (In a browser)
exec ("Python my program / application / mmp / HTOSS / sffile.exml"); or like it:
exec ("/ path / to / python path / to / myprogram / applications / mamp / htdocs / somefile.xml "); Is this method correct?
If not, what should be the correct way to do it?
Thanks
I use proc_open () I would like to do as you suggest by MVDS as you can not write STDIN nor from STDOUT to exec () / shell_exec () , as well as your own Read the environment variable - providing $ _ ENV .
The sample snippet removed from my code:
$ process = proc_open ("{$ command}", array (array ('pipe', 'r'), Array ('pipe', 'w'), array ('pipe', 'w'), $ pip, zero, $ _ENV; if (is_resource ($ process)) {fwrite ($ pipe [0], $ string ); Fclose ($ pipe [0]); $ Rt = stream_get_contents ($ pipe [1]); fclose ($ pipe [1]); $ RtErr = stream_get_contents ($ pipe [2]); fclose ($ pipe [2] ]; $ ExitCode = proc_close ($ process);} Read more:
Comments
Post a Comment