how to execute a program in php using shell_exec()

Viewed 52

I am trying to compile python code using shell_exec(), or exec(). The code I am trying:

$output = shell_exec("C:/Users/AS/AppData/Local/Microsoft/WindowsApps/python.exe C:/wamp64/www/project/app/code.py 2>&1");
echo $output;

when I execute the command in shell or in the command line It works fine, However using php and (Apache sever) I get The system cannot execute the specified program. Though I can successfully execute different commands such as mkdir, but if I try any command with .exe extension in my windows 11, I get the the same error as above.

0 Answers
Related