Php-fpm does not show errors from php exec function

I am using the PHP exec function to run some python scripts. I used apache and it logged all errors in the error.log file. Whenever there was a syntax error or something else, it was logged in the apache error log. But now I have installed nginx and php-fpm.

The problem here is that whenever an error occurs in python, nginx writes nothing to error.log. The $ output passed as the second argument to exec is also an empty array. So now I can not get errors from python or terminal. Please show me a way to get these errors ....

+4
source share
2 answers

You can set your error log in your nginx site configuration file: nginx/sites/sites-available/{RELEVANT SITE FILE} .

Make sure you have this inside your file:

 error_log /var/www/logs/nginx.error.log debug_http; 

You can also try using the php error report:

 <?php error_reporting(E_ALL); ini_set('display_errors', '1'); // Manual Error Log Creation error_log($customError, 3, "/var/www/logs/php.error.log"); // YOUR CODE BELOW ?> 

Another thing to keep in mind is if you don’t output anything at all, then it may also appear as an error, check out this other postoverflow post .

+4
source

Nginx is not responsible for such registration.

You must add error logging directives to your php-fpm.conf

+2
source

All Articles