I have a python script abc.py
that prints out "ABC".
When I tried to launch this script to get the printed result in php with this code
<?php
$cmd = "/usr/bin/python abc.py";
$handle = popen($cmd, 'r');
$res = fread($handle, 8192);
pclose($handle);
# Now you can make pretty printer about it.
return $res;
?>
The $res
is empty.
And with $cmd = "/usr/bin/python abc.py 2>&1";
, I got this error message /usr/bin/python: can't open file 'abc.py': [Errno 13] Permission denied
.
What's wrong with this? I got same error even when I make the file abc.py accessible to everyone.