Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx -> php5-fpm: Error in php not logged (anywhere!)

I am attempting to set up phpbb on an EC2 server. After an hour or so of despair I found that a particular line in the phpbb startup is failing:

$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false);

Easy fix, I need to configure my DB properties properly.

However, to find that I had to insert echo '1' statements block by block throughout the first couple files of the php app. Prior to the echo statements, I'd get just a blank page, with status 200, when php errored out.

I've turned on both log_errors and display_errors in FPM's php.ini, but apparently they don't do anything with this particular type of error.

There are no logs about the error in /var/log/syslog, /var/log/nginx/*, /var/log/php-fpm.log, or the error log for the nginx site.

So, my question: why is the actual error (from sql_connect) not being logged anywhere? (Alternately, if it is being logged, where?)

like image 335
user717847 Avatar asked Jul 14 '13 22:07

user717847


People also ask

Where can I find PHP-FPM logs?

A complete debug log for PHP-FPM errors can be found in the /opt/bitnami/php/var/log directory.

How can I tell if PHP-FPM is running?

First open the php-fpm configuration file and enable the status page as shown. Inside this file, find and uncomment the variable pm. status_path = /status as shown in the screenshot. Save the changes and exit the file.


2 Answers

search for catch_workers_output in your pool and set it to yes, from the doc:

 catch_workers_output - Redirect workers' stdout and stderr into main error log. If not set, they will be redirected to /dev/null, according to FastCGI specs. Values "yes" or "no" 

EDIT:

also check you have

php_flag[display_errors] = on

and/or

php_admin_flag[log_errors] = true
like image 88
DRC Avatar answered Oct 24 '22 00:10

DRC


I had a similar problem today. What I discovered is that the permissions for my log file were incorrect. Ownership was assigned to root. I did a chmod 777 php5-fpm.log to confirm that was the issue and it was. Logging worked after that.

I did a chown syslog:adm php5-fpm.log to set the correct ownership.

like image 28
Mark Avatar answered Oct 24 '22 01:10

Mark