python - How can I get shell_exec to run on my server?Get the solution ↓↓↓
So I know there are plenty of similar questions on the site, but I can't find any answers that explain clearly enough a solution to my problem. Hopefully a clear answers to this could help many others!
I've got two files, test.php and test.py.
<?php $output = shell_exec('test.py'); echo $output; ?>
PHP prints "hello, world" on localhost, but not on the server (Unix, I think), where everything is blank. I can successfully run test.py on the server with the command line, and have checked function_exists('shell_exec') in PHP, which it does.
I understand that I might need to give the server permission to use shell_exec, but this is where I get a bit confused. Any help would be much appreciated, thank you!
So I finally solved this. Turns out
$output = exec('python test.py');
does the job. Thanks to Lawrence for the pointer!
People are also looking for solutions of the problem: the metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.