Skip to content
Advertisement

‘python’ is not recognized as an internal or external command, operable program or batch file. error when running PHP shell_exec

I’m running this code via PHP file.

<?php 
echo shell_exec('python C:/wamp64/www/registration/test.py 2>&1');
?>

I’m getting this error,

‘python’ is not recognized as an internal or external command, operable program or batch file

I have added path variable correctly and when I run python in command line starts python console. I’m not familier with python so great if someone can help. (I’m using windows 10 and wamp server)

Advertisement

Answer

Try to put full path, like this:

    echo shell_exec('C:/python27/python.exe C:/wamp64/www/registration/test.py 2>&1');

Just replace it with your path

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement