我在Ubuntu上使用Nginx的PHP-FPM。我正尝试从Web应用程序启动PHP任务。PHP exec()不运行所有命令
以下两个示例在从CLI运行文件时正常工作,但不能从Nginx运行。
exec("notify-send 'Starting master at ".date("h:m:s")."'");
echo exec("/home/rohit/Projects/webapp/console/index.php blast 23");
这两个函数都可以在CLI和Nginx中正常工作。
echo exec("whoami");
echo exec("pwd");
我试图将PHP-FPM用户从www-data改为rohit(我的用户名),但没有运气。我究竟做错了什么?
你检查了php-fpm错误日志吗?或者只设置'E_ALL'和'display_errors = on' – tylerl
这是在开发机器上,所以所有的错误都在。我通过shell(su www-data)检查,除notify-send之外的所有命令都正常工作。通知 - 发送失败。我的错误使用notify-send进行调试。 – Rohit