I have WAMP installed on my Windows PC. I have a python script that has the following code, which is supposed to run my php script located in www of wamp (C:\wamp64\www)
import subprocess
subprocess.call("php C:\wamp64\www\index.php")
I also tried the below but it did not work also
import subprocess
subprocess.call("C:\wamp64\bin\php\php5.6.31\php.exe C:\wamp64\www\index.php")
However, when I run the python code from IPython I get the following error. (see image)
asked Sep 10, 2017 at 14:48
tony9099
4,7559 gold badges48 silver badges76 bronze badges
1 Answer 1
Add full path of PHP
subprocess.call("C:/wamp64/bin/php/php5.6.31 C:/wamp64/www/index.php")
Or Add php to environment variables. Open CMD and type:
SET PATH=%PATH%;C:\wamp64\bin\php\php5.6.31
answered Sep 10, 2017 at 15:07
mwweb
7,9454 gold badges21 silver badges25 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default
subprocess.call("php C:/wamp64/www/index.php")- \ is an escape charactersubprocess.call(r"php C:\wamp64\www\index.php")and if possible, state the full path to thephpbinarysubprocess.call("C:/wamp64/bin/php/yourphpversion C:/wamp64/www/index.php")subprocess.call("C:/wamp64/bin/php/php5.6.31 C:/wamp64/www/index.php")try this