Run python script from PHP in windows
<p>I want to run <code>python</code> script from <code>php</code>. I am on <code>python 3.5 , 64 bit</code> .I have read <a href="http://stackoverflow.com/questions/9283065/run-a-python-script-from-the-prompt-in-windows">StackQ1</a> and  <a href="http://stackoverflow.com/questions/28622526/how-to-correctly-run-python-script-from-php">StackQ2</a>. No one was helpful. I am running this code </p>

<pre><code>&lt;?php
$py = exec("D:/pythonFolder/python C:/wamp64/www/python.py");
echo $py;
?&gt;
</code></pre>

<p><code>D:/pythonFolder/python</code> is the path to <code>python.exe</code>. On running the above code, nothing happens. I also tried with this <code>$py = shell_exec("python C:/wamp64/www/python.py");</code> and this <code>$py = exec("python C:/wamp64/www/python.py");</code> but no success. 
Any help will be appreciative.</p>

<p>If you want to capture any output from the python script, you need to use shell_exec.  Otherwise you're just running the script and the output isn't going anywhere.  There are different commands for different purposes.  Exec only runs a command, doesn't care about any potential return values.</p>

<p><a href="http://php.net/manual/en/book.exec.php" rel="nofollow">http://php.net/manual/en/book.exec.php</a></p>

php python