I have set up an Apache 2 server on a Raspberry Pi with an index.php which I can access from any computer on the network. In the same folder (/var/www) I also have a python script test.py.
The script works fine when running it manually. However, I want to be able to run the script in my browser by using php. I tried this:
<?php
$command = escapeshellcmd('test.py');
$output = shell_exec($command);
echo $output;
?>
However nothing happens. I also tried using the full filepath /var/www/test.py, but that didn't work either.
Any suggestions on how I can get this working?