经过一段时间的正确工作PHP不能执行任何系统命令

我正在设置一个新的Web服务器。 我在ubuntu 16.04上用php-fpm有NGINX。 除了一件事以外,一切都很好:经过2-3天的正确工作PHP不能运行任何外部系统命令。 当我说“系统命令”时,我的意思是什么? 例如,当我运行函数shell_exec参数'whoami'

echo shell_exec('whoami');

我得到以下

警告:shell_exec():无法执行'whoami'

而PHP脚本试图执行的每个Linux命令都会发生这种情况

当我试图使用邮件()函数发送邮件时,我收到类似的错误

警告:邮件():无法执行邮件传送程序'/ usr / sbin / sendmail -t -i'

只有当我从浏览器运行PHP脚本时才会发生。 如果我尝试从terminal运行它像这样

sudo -u www-data php /path/to/my/script.php

那么一切正常。

再次说明:只有经过一段时间的正确工作,问题才会出现,并在VDS重新启动后消失(一段时间)。 只有当我从浏览器运行脚本,这意味着它由NGINX服务。

请帮我find解决我的问题。

PS日志:Php错误日志

[27-Aug-2016 04:19:37 Europe/Moscow] PHP Fatal error: Uncaught Error: Call to a member function is_logged() on null in /home/serv/www/templates/page_parts/header_tpl.php:6 Stack trace: #0 /home/serv/www/templates/index_tpl.php(9): require() #1 /home/serv/www/php_classes/templater_class.php(116): include('/home/serv/www/...') #2 /home/serv/www/functions.php(827): templater->load_template() #3 /home/serv/www/functions.php(804): error_wrong_csrf() #4 /home/serv/www/index.php(16): csrf_check_post('1b46edd81f1563a...') #5 {main} thrown in /home/serv/www/templates/page_parts/header_tpl.php on line 6 [27-Aug-2016 04:19:48 Europe/Moscow] PHP Warning: mail(): Could not execute mail delivery program '/usr/sbin/sendmail -t -i ' in /home/serv/www/php_classes/mail_class.php on line 84 [27-Aug-2016 04:27:42 Europe/Moscow] PHP Warning: shell_exec(): Unable to execute 'whoami' in /home/serv/www/test_mail.php on line 29 

系统日志:

 Aug 27 04:39:01 frankfurt CRON[30551]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean) Aug 27 04:39:01 frankfurt CRON[30552]: (root) CMD ( test -x /etc/cron.daily/popularity-contest && /etc/cron.daily/popularity-contest --crond) 

在php7.0-fpm.log中没有任何东西