Does anyone know of this issue? I am using exec()
command to execute my python script from wordpress(WordPress 4.4.2 i),But Its not returning anything,I am using windows 7 /wamp. when I tried to run the same script from /wamp/www
its working fine.
here is my php script:
exec("C:Python27python.exe D:wampwwwpython_script.py ",$out);
echo '<pre>';print_r($out);
In python I am just trying to print 'Hello World';
Any Idea?
You’re using
"
-quoted strings, soC:Python27python.exe D:wampwwwpython_script.py
is actually parsed asC:Python27python.exe D:wampwwwptyhon_script.py
– theP
,p
,w
etc are NOT string metacharacters, so the escape is simply lost in PHP, and never reaches the shell you’re executing.You need
instead. Note the doubled
\
.And note that this has nothing to do with WordPress. This is a PHP “problem”.