I need to run a Python file after clicking on a button. PHP’s shell_exec function works fine for commands like ‘ls’ but I’m not able to pass arguments like -
python qwerty.py to that function.
Thanking you in advance
Why can’t you pass arguments? It should execute whatever you pass it.
I can pass the arguments
Example,
shell_exec(“python qwerty.py”)
This command if echoed doesn’t give any output.
I have tried variants like passing the complete path to the file or the python interpreter or both
So,
$output = shell_exec("python qwerty.py");
var_dump($output);
shows nothing? If you just run python qwerty.py
in the terminal, does it produce output?
1 Like
It’s giving the correct output. Thanks!️
Hi,
May I ask a question?
If it’s directly related to this thread, ask away. If it isn’t, open a new thread and ask there, don’t reopen dead threads unless you need to.