Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP's configuration setting 'error_log' is not working

What am I doing wrong here?

I have error_log set in the .ini file along with error_reporting = E_ALL | E_STRICT.

What else am I missing? This usually gave it to me. I want this set in the .ini file and not in my scripts.

Another interesting thing that is happening is that when I purposefully try and throw an error in one of my scripts, Apache restarts over and over again.


This is my event log after one error. Look at the timestamp.

Wed Nov 04 19:34:23 2009] [notice] Apache/2.2.14 (Win32) PHP/5.3.0 configured -- resuming normal operations [Wed Nov 04 19:34:23 2009] [notice] Server built: Sep 28 2009 22:41:08 [Wed Nov 04 19:34:23 2009] [notice] Parent: Created child process 1700 [Wed Nov 04 19:34:23 2009] [notice] Child 1700: Child process is running [Wed Nov 04 19:34:23 2009] [notice] Child 3008: Released the start mutex [Wed Nov 04 19:34:23 2009] [notice] Child 1700: Acquired the start mutex. [Wed Nov 04 19:34:23 2009] [notice] Child 1700: Starting 64 worker threads. [Wed Nov 04 19:34:23 2009] [notice] Child 1700: Starting thread to listen on port 80. [Wed Nov 04 19:34:24 2009] [notice] Child 3008: All worker threads have exited. [Wed Nov 04 19:34:24 2009] [notice] Child 3008: Child process is exiting [Wed Nov 04 19:34:53 2009] [notice] Parent: child process exited with status 128 -- Restarting. [Wed Nov 04 19:34:53 2009] [notice] Apache/2.2.14 (Win32) PHP/5.3.0 configured -- resuming normal operations [Wed Nov 04 19:34:53 2009] [notice] Server built: Sep 28 2009 22:41:08 [Wed Nov 04 19:34:53 2009] [notice] Parent: Created child process 3656 [Wed Nov 04 19:34:53 2009] [notice] Child 3656: Child process is running [Wed Nov 04 19:34:53 2009] [notice] Child 3656: Acquired the start mutex. [Wed Nov 04 19:34:53 2009] [notice] Child 3656: Starting 64 worker threads. [Wed Nov 04 19:34:53 2009] [notice] Child 3656: Starting thread to listen on port 80. [Wed Nov 04 19:34:53 2009] [notice] Parent: child process exited with status 128 -- Restarting. [Wed Nov 04 19:34:54 2009] [notice] Apache/2.2.14 (Win32) PHP/5.3.0 configured -- resuming normal operations [Wed Nov 04 19:34:54 2009] [notice] Server built: Sep 28 2009 22:41:08 [Wed Nov 04 19:34:54 2009] [notice] Parent: Created child process 3980 [Wed Nov 04 19:34:54 2009] [notice] Child 3980: Child process is running [Wed Nov 04 19:34:54 2009] [notice] Child 3980: Acquired the start mutex. [Wed Nov 04 19:34:54 2009] [notice] Child 3980: Starting 64 worker threads. [Wed Nov 04 19:34:54 2009] [notice] Child 3980: Starting thread to listen on port 80. [Wed Nov 04 19:34:54 2009] [notice] Parent: child process exited with status 128 -- Restarting. [Wed Nov 04 19:34:54 2009] [notice] Apache/2.2.14 (Win32) PHP/5.3.0 configured -- resuming normal operations [Wed Nov 04 19:34:54 2009] [notice] Server built: Sep 28 2009 22:41:08 [Wed Nov 04 19:34:54 2009] [notice] Parent: Created child process 1600 [Wed Nov 04 19:34:54 2009] [notice] Child 1600: Child process is running [Wed Nov 04 19:34:54 2009] [notice] Child 1600: Acquired the start mutex. [Wed Nov 04 19:34:54 2009] [notice] Child 1600: Starting 64 worker threads. [Wed Nov 04 19:34:54 2009] [notice] Child 1600: Starting thread to listen on port 80. [Wed Nov 04 19:34:55 2009] [notice] Parent: child process exited with status 128 -- Restarting. [Wed Nov 04 19:34:55 2009] [notice] Apache/2.2.14 (Win32) PHP/5.3.0 configured -- resuming normal operations [Wed Nov 04 19:34:55 2009] [notice] Server built: Sep 28 2009 22:41:08 [Wed Nov 04 19:34:55 2009] [notice] Parent: Created child process 1068 [Wed Nov 04 19:34:55 2009] [notice] Child 1068: Child process is running [Wed Nov 04 19:34:55 2009] [notice] Child 1068: Acquired the start mutex. [Wed Nov 04 19:34:55 2009] [notice] Child 1068: Starting 64 worker threads. [Wed Nov 04 19:34:55 2009] [notice] Child 1068: Starting thread to listen on port 80. [Wed Nov 04 19:34:55 2009] [notice] Parent: child process exited with status 128 -- Restarting. [Wed Nov 04 19:34:55 2009] [notice] Apache/2.2.14 (Win32) PHP/5.3.0 configured -- resuming normal operations [Wed Nov 04 19:34:55 2009] [notice] Server built: Sep 28 2009 22:41:08 [Wed Nov 04 19:34:55 2009] [notice] Parent: Created child process 3220 [Wed Nov 04 19:34:56 2009] [notice] Child 3220: Child process is running [Wed Nov 04 19:34:56 2009] [notice] Child 3220: Acquired the start mutex. [Wed Nov 04 19:34:56 2009] [notice] Child 3220: Starting 64 worker threads. [Wed Nov 04 19:34:56 2009] [notice] Child 3220: Starting thread to listen on port 80. 

This has been asked 1000 times and I have browsed through the different posts before posting this, but I have not found an answer. As long as I have been programming with PHP, this have always been a nightmare to get working.

like image 598
Jim Avatar asked Nov 05 '09 02:11

Jim


People also ask

How do I enable PHP logging?

Enable Error Logging in php. If you want to enable PHP error logging in individual files, add this code at the top of the PHP file. ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); Now, you must enable only one statement to parse the log errors in the php.

Where does PHP error_log go?

The location of the error log file itself can be set manually in the php. ini file. On a Windows server, in IIS, it may be something like "'error_log = C:\log_files\php_errors. log'" in Linux it may be a value of "'/var/log/php_errors.

What is error_log?

What Does Error Log Mean? In computer science, an error log is a record of critical errors that are encountered by the application, operating system or server while in operation. Some of the common entries in an error log include table corruption and configuration corruption.


1 Answers

Check PHP-FPM is not explicitly setting error_log:

Make sure the file /etc/php-fpm.d/www.conf does not contain php_admin_value settings for error_log. Search for the following and comment them out using a semi-colon:

; NOTE: If these are set, ini_set('error_log', 'path') will have no effect ; inside your php code, and this will be forced to be the value always. ; php_admin_value[error_log] = /var/log/php-fpm/www-error.log ; php_admin_flag[log_errors] = on 

Then restart php-fpm:

systemctl restart php-fpm 

Check Apache .htaccess files are not setting the error_log value using

php_admin_value settings in the Apache configuration files cannot be overridden, so make sure you don’t have any php_admin_value for the error_log setting in the Apache configuration files. Also check for php_value settings just in case.

PHP Website - How to change configuration settings

like image 170
Basil Musa Avatar answered Sep 17 '22 16:09

Basil Musa