I have a PHP script that I’d like to run both via the browser and from the command line. When I run the script from the command line, it executes without a problem. However, when I call it via a function such as exec or passthru, it doesn’t work. I’m not getting any output from the call and I see no errors in the logs. I’m very confused…
echo exec('php /usr/share/nginx/www/function.php arg1');
Any ideas?
The output is captured in a parameter variable as an array and not returned back, when you use
exec(). So do something like this: