php error_log not working









up vote
22
down vote

favorite
3












This has been asked 1000 times and I have browsed through the different posts before posting this but have not found an answer. As long as I have been prgramming with PHP, this have always been a nightmare to get working. Can someone please tell me what I am 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 purposfully try and throw an error in one of my scripts, Apache restarts over and over again.




This is my event log after one error. Loot 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.









share|improve this question



























    up vote
    22
    down vote

    favorite
    3












    This has been asked 1000 times and I have browsed through the different posts before posting this but have not found an answer. As long as I have been prgramming with PHP, this have always been a nightmare to get working. Can someone please tell me what I am 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 purposfully try and throw an error in one of my scripts, Apache restarts over and over again.




    This is my event log after one error. Loot 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.









    share|improve this question

























      up vote
      22
      down vote

      favorite
      3









      up vote
      22
      down vote

      favorite
      3






      3





      This has been asked 1000 times and I have browsed through the different posts before posting this but have not found an answer. As long as I have been prgramming with PHP, this have always been a nightmare to get working. Can someone please tell me what I am 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 purposfully try and throw an error in one of my scripts, Apache restarts over and over again.




      This is my event log after one error. Loot 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.









      share|improve this question















      This has been asked 1000 times and I have browsed through the different posts before posting this but have not found an answer. As long as I have been prgramming with PHP, this have always been a nightmare to get working. Can someone please tell me what I am 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 purposfully try and throw an error in one of my scripts, Apache restarts over and over again.




      This is my event log after one error. Loot 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.






      php error-logging error-log selinux






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 23 '15 at 15:41









      Anthony

      392615




      392615










      asked Nov 5 '09 at 2:48









      Jim

      121116




      121116






















          14 Answers
          14






          active

          oldest

          votes

















          up vote
          9
          down vote













          You also need to set log_errors = On in php.ini.






          share|improve this answer


















          • 3




            Hi Chaos, thanks. I already have that set to On. Am I missing anything else?
            – Jim
            Nov 5 '09 at 2:55










          • Just restart the server.
            – aagjalpankaj
            Apr 7 '17 at 5:48

















          up vote
          8
          down vote













          The problem I ran into was that the error log I had designated was write protected. All my .htaccess settings were correct, PHP just couldn't write to the error log because it had no permissions. This fixed it right up for me:



          chmod 777 watermellon-app-errors.log


          Obviously, you're going to want to change the .log to whatever file you're using for a log.






          share|improve this answer
















          • 4




            Do the logs really need 777? Ain't 644 enough?
            – hugo der hungrige
            Apr 3 '13 at 22:22






          • 1




            Yes, you're correct. Of course, 644 might not be enough if the file's owner is someone else. You could use 777 to test it, and then lower permissions to see what works.
            – Thomas Keene
            Aug 29 '13 at 18:42











          • In my case, I needed 646.. just FYI in case someone else runs into a problem like me
            – FastTrack
            Jan 26 '16 at 17:17










          • On Mac OS, I had to use 666 since the normal files are set up as root:wheel I probably could have left it 646 since I think apache is running as "_www" by default.
            – Phil Glau
            Mar 3 '17 at 22:19










          • Works on - Nginx+Httpd (Centos 6.6), thanks.
            – Sid
            Sep 17 at 10:06

















          up vote
          8
          down vote













          In case anyone else is having trouble getting their local development environment to log errors, here's what fixed it for me:



          On windows, error_log must be set to the complete path to the log for error_log() to work (error_log = c:apachephp_errors.log). However, if error_log = php_errors.log with no path, php will still be able to log startup errors such as



          PHP Startup: Unable to load dynamic library 'extphp_mysqli.dll' - The specified module could not be found





          share|improve this answer






















          • I specified full path and did not create the file in advance. When I restart WAMP the log file is created but WAMP display a yellow icon and localhost won't load. Any ideas what that might be? When I comment out error_log everything is fine but PHP errors appear in the Apache log.
            – thomthom
            Dec 28 '12 at 1:02

















          up vote
          4
          down vote













          If the error_log directive is set, the file will be used for recording php errors, when it is not set errors will be logged to the Apache log. Take a look at http://us3.php.net/manual/en/errorfunc.configuration.php#ini.error-log.



          The error_log file and the directory it's in must be writable by the user that Apache is running under. If the file isn't being created, it's probably due to a permissions issue.



          I don't know for sure why Apache would be crashing on you, but I'm guessing it's a permissions issue of some sort.






          share|improve this answer






















          • I stand corrected, thanks. I've edited my answer.
            – bradym
            Nov 19 '09 at 16:05

















          up vote
          3
          down vote













          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 apache configuration files cannot be overridden, so make sure you dont 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






          share|improve this answer



























            up vote
            1
            down vote













            I don't understand why, but the error log is now working. Here is what I did. I gave up and commented back out the error_log directive and closed the ini file. I ran the script with the parse error to see of Apache would still crash and I got the PHP error in the log file. This is freaky because the ini file no longer has error_log enabled and my script is not using ini_set().



            Does anyone have an explanation for this madness? Also, Apache no longer crashes.






            share|improve this answer
















            • 2




              "Madness" is a pretty good explanation.
              – Justin Johnson
              Nov 5 '09 at 5:12

















            up vote
            1
            down vote













            If you are using Fedora, SELinux (enabled by default) will prevent apache / httpd from appending errors to your log file even when your file is specified in php.ini and its containing directory has all permissions allowed.



            You can see if this is happening by looking at your system log file in /var/log/messages



            enter image description here



            The ideal solution is to configure SELinux to allow access on the log file.



            The quicker solution is to disable SELinux in /etc/selinux/config by setting SELINUX to disabled.



            You'll need to reboot your system after doing this for the change to take effect.






            share|improve this answer


















            • 1




              The advice you gave actually has a website to stop that advice being given. stopdisablingselinux.com
              – ʰᵈˑ
              Mar 23 '15 at 15:47







            • 1




              I know, hence my writing "ideal." I'm not yet convinced that a home user working locally needs SELinux turned on.
              – Anthony
              Mar 23 '15 at 19:42

















            up vote
            1
            down vote













            In my case, on a CentOS development server, after a full yum update the permission on /var/log/http was changed to 700 and the user to 'root', so the user 'apache' wasn't able to enter or write into it. It was still able to write into the existing file /var/log/httpd/error.log but it wasn't able to create a new file, as I use date-suffixed log files.
            Issuing the command



            chown apache /var/log/httpd


            solved the problem.






            share|improve this answer





























              up vote
              0
              down vote













              As bradym said, check whether you have write permissions to the directory where you php error log is located for apache user. If you created a log file with written permissions it's not enough, the dir should have them too.






              share|improve this answer



























                up vote
                0
                down vote













                The error_log = "C:phpLogerror.log" was not working for me either. The solution for me was that you shouldn't create the error.log yourself, because PHP will do it for you. See the PHP message board. I'm using PHP 5.2 on a Windows 2008 server






                share|improve this answer



























                  up vote
                  0
                  down vote













                  The way it works on my ubuntu (Apache 2.4.7, PHP 5.5.9) is the following:



                  command line script:



                  • writes the log into the path pointed by error_log if log_errors = On. Settings in /etc/php5/cli/php.ini;

                  web request via apache:



                  • if log_errors = On (/etc/php5/apache2/php.ini), the error appended into the path pointed by ErrorLog apache directive in the virtualhost. If that directive does not exist, the php.ini error_log path is used;

                  • if log_errors = Off not logs are written anywhere;

                  As far as I remember, it almost worked this way in most of the linux stacks






                  share|improve this answer



























                    up vote
                    0
                    down vote













                    This did the trick for me.



                    setsebool -P httpd_unified 1


                    Please note, this would be the preferred method below to try first:



                    semanage fcontext -a -t httpd_sys_rw_content_t 'errorLogNameHere.error.log
                    restorecon -v 'errorLogNameHere.error.log'


                    This answer was derived from the logs from executing this command line:



                    journalctl -xe 


                    Further information on the system I was running on:
                    PHP 7.0 and
                    CentOS 7



                    Not sure if it's not obvious, but the issue was Apache's configuration to writing files. I did try chmod 777, chmod a+w on the logging directory, but this didn't work for me.



                    Hope this can help somebody.






                    share|improve this answer



























                      up vote
                      0
                      down vote













                      Here is my troubleshooting guide to error_log() calls not working.




                      1. Look at your server's configuration to find out where the default error log file is.



                        This depends on which server you're using. To get you started, have a look at Apache's ErrorLog option if you're using Apache or Nginx's error_log option if you're using Nginx. Make sure it is set to a file. If you're using a tool like Valet, note that it's using server software like Nginx behind the scenes.




                      2. Check the permissions of your server's error log file.



                        On Unix-like systems, it should be writeable by the correct user and group, and the permissions of the parent directory and all its ancestors need to be correct as well. Use chmod and chown.




                      3. Check the configuration of PHP in the .ini files.



                        Specifically, check for log_errors = On and error_reporting = E_ALL | E_STRICT and error_log = /tmp/example/php_errors.log (see docs for log_errors, error_reporting and error_log configuration settings). To find the .ini file, look at the output of phpinfo();. If error_log is not set, by default it goes to the error log for the server, mentioned in the previous steps. If error_log is set to a file, it should already exist and be writeable, just like in previous steps. Remember to restart the server after configuration changes.




                      4. Check that PHP's settings aren't being changed by server configuration.



                        Your server's configuration (even .htaccess) can change PHP configuration settings. In Apache, this is done using php_admin_value and php_admin_flag (docs). For instance, you may find in your .htaccess file this line: php_admin_flag[log_errors] = off. Remember to restart the server after configuration changes.



                        At this point, you should be able to create a test file test.php with the contents <?php error_log("test");, restart your server, and open the URL in your browser, and you should be able to see test in your error log (either the server's, or the one specified by error_log =). But keep reading.




                      5. Check that PHP's settings aren't being changed at run-time.



                        The log_errors option can be changed at runtime by running ini_set('log_errors', 1);, and so can the other configuration options error_reporting and error_log. Also note there is a special error_reporting() PHP function which changes the configuration at run-time. Search your code-base for any invocations of ini_set or error_reporting. WordPress for example does run these depending on the value of WP_DEBUG.



                      Other things to look at: You may be having permission issues in SELinux (see this answer).






                      share|improve this answer



























                        up vote
                        -3
                        down vote













                        Make sure and also set



                        display_errors = On


                        And try



                         error_reporting(E_ALL);


                        In your code. Often times I include a runtime error config script that turns errors on when I'm developing, and turns them back off when I'm not. It looks something roughly like this:



                        if ($debugmode == 'on') 
                        error_reporting(E_ALL);
                        ini_set("display_errors", 1);
                        else
                        error_reporting(0);
                        ini_set("display_errors", 0);



                        Hope this helps.



                        ** I didn't read that correctly, you want to log errors instead of display, in that case Chaos' answer is what you're looking for.






                        share|improve this answer
















                        • 6




                          then please delete this post.
                          – mauris
                          Nov 5 '09 at 2:58






                        • 1




                          Hi Jeremy, thanks for the help. :)
                          – Jim
                          Nov 5 '09 at 3:03










                        • then please either delete the post as @mauris said, or make a better edit: starting stating (ans emphasized please) that this doesn't answer to OP's question but to something else in case you've landed here because of that...
                          – Erdal G.
                          Mar 20 at 13:59










                        Your Answer






                        StackExchange.ifUsing("editor", function ()
                        StackExchange.using("externalEditor", function ()
                        StackExchange.using("snippets", function ()
                        StackExchange.snippets.init();
                        );
                        );
                        , "code-snippets");

                        StackExchange.ready(function()
                        var channelOptions =
                        tags: "".split(" "),
                        id: "1"
                        ;
                        initTagRenderer("".split(" "), "".split(" "), channelOptions);

                        StackExchange.using("externalEditor", function()
                        // Have to fire editor after snippets, if snippets enabled
                        if (StackExchange.settings.snippets.snippetsEnabled)
                        StackExchange.using("snippets", function()
                        createEditor();
                        );

                        else
                        createEditor();

                        );

                        function createEditor()
                        StackExchange.prepareEditor(
                        heartbeatType: 'answer',
                        convertImagesToLinks: true,
                        noModals: true,
                        showLowRepImageUploadWarning: true,
                        reputationToPostImages: 10,
                        bindNavPrevention: true,
                        postfix: "",
                        imageUploader:
                        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                        allowUrls: true
                        ,
                        onDemand: true,
                        discardSelector: ".discard-answer"
                        ,immediatelyShowMarkdownHelp:true
                        );



                        );













                         

                        draft saved


                        draft discarded


















                        StackExchange.ready(
                        function ()
                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f1678009%2fphp-error-log-not-working%23new-answer', 'question_page');

                        );

                        Post as a guest






























                        14 Answers
                        14






                        active

                        oldest

                        votes








                        14 Answers
                        14






                        active

                        oldest

                        votes









                        active

                        oldest

                        votes






                        active

                        oldest

                        votes








                        up vote
                        9
                        down vote













                        You also need to set log_errors = On in php.ini.






                        share|improve this answer


















                        • 3




                          Hi Chaos, thanks. I already have that set to On. Am I missing anything else?
                          – Jim
                          Nov 5 '09 at 2:55










                        • Just restart the server.
                          – aagjalpankaj
                          Apr 7 '17 at 5:48














                        up vote
                        9
                        down vote













                        You also need to set log_errors = On in php.ini.






                        share|improve this answer


















                        • 3




                          Hi Chaos, thanks. I already have that set to On. Am I missing anything else?
                          – Jim
                          Nov 5 '09 at 2:55










                        • Just restart the server.
                          – aagjalpankaj
                          Apr 7 '17 at 5:48












                        up vote
                        9
                        down vote










                        up vote
                        9
                        down vote









                        You also need to set log_errors = On in php.ini.






                        share|improve this answer














                        You also need to set log_errors = On in php.ini.







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Nov 8 at 10:51









                        Flimm

                        48.6k23130151




                        48.6k23130151










                        answered Nov 5 '09 at 2:54









                        chaos

                        102k25271289




                        102k25271289







                        • 3




                          Hi Chaos, thanks. I already have that set to On. Am I missing anything else?
                          – Jim
                          Nov 5 '09 at 2:55










                        • Just restart the server.
                          – aagjalpankaj
                          Apr 7 '17 at 5:48












                        • 3




                          Hi Chaos, thanks. I already have that set to On. Am I missing anything else?
                          – Jim
                          Nov 5 '09 at 2:55










                        • Just restart the server.
                          – aagjalpankaj
                          Apr 7 '17 at 5:48







                        3




                        3




                        Hi Chaos, thanks. I already have that set to On. Am I missing anything else?
                        – Jim
                        Nov 5 '09 at 2:55




                        Hi Chaos, thanks. I already have that set to On. Am I missing anything else?
                        – Jim
                        Nov 5 '09 at 2:55












                        Just restart the server.
                        – aagjalpankaj
                        Apr 7 '17 at 5:48




                        Just restart the server.
                        – aagjalpankaj
                        Apr 7 '17 at 5:48












                        up vote
                        8
                        down vote













                        The problem I ran into was that the error log I had designated was write protected. All my .htaccess settings were correct, PHP just couldn't write to the error log because it had no permissions. This fixed it right up for me:



                        chmod 777 watermellon-app-errors.log


                        Obviously, you're going to want to change the .log to whatever file you're using for a log.






                        share|improve this answer
















                        • 4




                          Do the logs really need 777? Ain't 644 enough?
                          – hugo der hungrige
                          Apr 3 '13 at 22:22






                        • 1




                          Yes, you're correct. Of course, 644 might not be enough if the file's owner is someone else. You could use 777 to test it, and then lower permissions to see what works.
                          – Thomas Keene
                          Aug 29 '13 at 18:42











                        • In my case, I needed 646.. just FYI in case someone else runs into a problem like me
                          – FastTrack
                          Jan 26 '16 at 17:17










                        • On Mac OS, I had to use 666 since the normal files are set up as root:wheel I probably could have left it 646 since I think apache is running as "_www" by default.
                          – Phil Glau
                          Mar 3 '17 at 22:19










                        • Works on - Nginx+Httpd (Centos 6.6), thanks.
                          – Sid
                          Sep 17 at 10:06














                        up vote
                        8
                        down vote













                        The problem I ran into was that the error log I had designated was write protected. All my .htaccess settings were correct, PHP just couldn't write to the error log because it had no permissions. This fixed it right up for me:



                        chmod 777 watermellon-app-errors.log


                        Obviously, you're going to want to change the .log to whatever file you're using for a log.






                        share|improve this answer
















                        • 4




                          Do the logs really need 777? Ain't 644 enough?
                          – hugo der hungrige
                          Apr 3 '13 at 22:22






                        • 1




                          Yes, you're correct. Of course, 644 might not be enough if the file's owner is someone else. You could use 777 to test it, and then lower permissions to see what works.
                          – Thomas Keene
                          Aug 29 '13 at 18:42











                        • In my case, I needed 646.. just FYI in case someone else runs into a problem like me
                          – FastTrack
                          Jan 26 '16 at 17:17










                        • On Mac OS, I had to use 666 since the normal files are set up as root:wheel I probably could have left it 646 since I think apache is running as "_www" by default.
                          – Phil Glau
                          Mar 3 '17 at 22:19










                        • Works on - Nginx+Httpd (Centos 6.6), thanks.
                          – Sid
                          Sep 17 at 10:06












                        up vote
                        8
                        down vote










                        up vote
                        8
                        down vote









                        The problem I ran into was that the error log I had designated was write protected. All my .htaccess settings were correct, PHP just couldn't write to the error log because it had no permissions. This fixed it right up for me:



                        chmod 777 watermellon-app-errors.log


                        Obviously, you're going to want to change the .log to whatever file you're using for a log.






                        share|improve this answer












                        The problem I ran into was that the error log I had designated was write protected. All my .htaccess settings were correct, PHP just couldn't write to the error log because it had no permissions. This fixed it right up for me:



                        chmod 777 watermellon-app-errors.log


                        Obviously, you're going to want to change the .log to whatever file you're using for a log.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Oct 8 '12 at 18:58









                        Thomas Keene

                        19122




                        19122







                        • 4




                          Do the logs really need 777? Ain't 644 enough?
                          – hugo der hungrige
                          Apr 3 '13 at 22:22






                        • 1




                          Yes, you're correct. Of course, 644 might not be enough if the file's owner is someone else. You could use 777 to test it, and then lower permissions to see what works.
                          – Thomas Keene
                          Aug 29 '13 at 18:42











                        • In my case, I needed 646.. just FYI in case someone else runs into a problem like me
                          – FastTrack
                          Jan 26 '16 at 17:17










                        • On Mac OS, I had to use 666 since the normal files are set up as root:wheel I probably could have left it 646 since I think apache is running as "_www" by default.
                          – Phil Glau
                          Mar 3 '17 at 22:19










                        • Works on - Nginx+Httpd (Centos 6.6), thanks.
                          – Sid
                          Sep 17 at 10:06












                        • 4




                          Do the logs really need 777? Ain't 644 enough?
                          – hugo der hungrige
                          Apr 3 '13 at 22:22






                        • 1




                          Yes, you're correct. Of course, 644 might not be enough if the file's owner is someone else. You could use 777 to test it, and then lower permissions to see what works.
                          – Thomas Keene
                          Aug 29 '13 at 18:42











                        • In my case, I needed 646.. just FYI in case someone else runs into a problem like me
                          – FastTrack
                          Jan 26 '16 at 17:17










                        • On Mac OS, I had to use 666 since the normal files are set up as root:wheel I probably could have left it 646 since I think apache is running as "_www" by default.
                          – Phil Glau
                          Mar 3 '17 at 22:19










                        • Works on - Nginx+Httpd (Centos 6.6), thanks.
                          – Sid
                          Sep 17 at 10:06







                        4




                        4




                        Do the logs really need 777? Ain't 644 enough?
                        – hugo der hungrige
                        Apr 3 '13 at 22:22




                        Do the logs really need 777? Ain't 644 enough?
                        – hugo der hungrige
                        Apr 3 '13 at 22:22




                        1




                        1




                        Yes, you're correct. Of course, 644 might not be enough if the file's owner is someone else. You could use 777 to test it, and then lower permissions to see what works.
                        – Thomas Keene
                        Aug 29 '13 at 18:42





                        Yes, you're correct. Of course, 644 might not be enough if the file's owner is someone else. You could use 777 to test it, and then lower permissions to see what works.
                        – Thomas Keene
                        Aug 29 '13 at 18:42













                        In my case, I needed 646.. just FYI in case someone else runs into a problem like me
                        – FastTrack
                        Jan 26 '16 at 17:17




                        In my case, I needed 646.. just FYI in case someone else runs into a problem like me
                        – FastTrack
                        Jan 26 '16 at 17:17












                        On Mac OS, I had to use 666 since the normal files are set up as root:wheel I probably could have left it 646 since I think apache is running as "_www" by default.
                        – Phil Glau
                        Mar 3 '17 at 22:19




                        On Mac OS, I had to use 666 since the normal files are set up as root:wheel I probably could have left it 646 since I think apache is running as "_www" by default.
                        – Phil Glau
                        Mar 3 '17 at 22:19












                        Works on - Nginx+Httpd (Centos 6.6), thanks.
                        – Sid
                        Sep 17 at 10:06




                        Works on - Nginx+Httpd (Centos 6.6), thanks.
                        – Sid
                        Sep 17 at 10:06










                        up vote
                        8
                        down vote













                        In case anyone else is having trouble getting their local development environment to log errors, here's what fixed it for me:



                        On windows, error_log must be set to the complete path to the log for error_log() to work (error_log = c:apachephp_errors.log). However, if error_log = php_errors.log with no path, php will still be able to log startup errors such as



                        PHP Startup: Unable to load dynamic library 'extphp_mysqli.dll' - The specified module could not be found





                        share|improve this answer






















                        • I specified full path and did not create the file in advance. When I restart WAMP the log file is created but WAMP display a yellow icon and localhost won't load. Any ideas what that might be? When I comment out error_log everything is fine but PHP errors appear in the Apache log.
                          – thomthom
                          Dec 28 '12 at 1:02














                        up vote
                        8
                        down vote













                        In case anyone else is having trouble getting their local development environment to log errors, here's what fixed it for me:



                        On windows, error_log must be set to the complete path to the log for error_log() to work (error_log = c:apachephp_errors.log). However, if error_log = php_errors.log with no path, php will still be able to log startup errors such as



                        PHP Startup: Unable to load dynamic library 'extphp_mysqli.dll' - The specified module could not be found





                        share|improve this answer






















                        • I specified full path and did not create the file in advance. When I restart WAMP the log file is created but WAMP display a yellow icon and localhost won't load. Any ideas what that might be? When I comment out error_log everything is fine but PHP errors appear in the Apache log.
                          – thomthom
                          Dec 28 '12 at 1:02












                        up vote
                        8
                        down vote










                        up vote
                        8
                        down vote









                        In case anyone else is having trouble getting their local development environment to log errors, here's what fixed it for me:



                        On windows, error_log must be set to the complete path to the log for error_log() to work (error_log = c:apachephp_errors.log). However, if error_log = php_errors.log with no path, php will still be able to log startup errors such as



                        PHP Startup: Unable to load dynamic library 'extphp_mysqli.dll' - The specified module could not be found





                        share|improve this answer














                        In case anyone else is having trouble getting their local development environment to log errors, here's what fixed it for me:



                        On windows, error_log must be set to the complete path to the log for error_log() to work (error_log = c:apachephp_errors.log). However, if error_log = php_errors.log with no path, php will still be able to log startup errors such as



                        PHP Startup: Unable to load dynamic library 'extphp_mysqli.dll' - The specified module could not be found






                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Sep 21 '17 at 17:17









                        Alex M

                        2,33471928




                        2,33471928










                        answered Nov 13 '12 at 22:20









                        Mel Reams

                        19633




                        19633











                        • I specified full path and did not create the file in advance. When I restart WAMP the log file is created but WAMP display a yellow icon and localhost won't load. Any ideas what that might be? When I comment out error_log everything is fine but PHP errors appear in the Apache log.
                          – thomthom
                          Dec 28 '12 at 1:02
















                        • I specified full path and did not create the file in advance. When I restart WAMP the log file is created but WAMP display a yellow icon and localhost won't load. Any ideas what that might be? When I comment out error_log everything is fine but PHP errors appear in the Apache log.
                          – thomthom
                          Dec 28 '12 at 1:02















                        I specified full path and did not create the file in advance. When I restart WAMP the log file is created but WAMP display a yellow icon and localhost won't load. Any ideas what that might be? When I comment out error_log everything is fine but PHP errors appear in the Apache log.
                        – thomthom
                        Dec 28 '12 at 1:02




                        I specified full path and did not create the file in advance. When I restart WAMP the log file is created but WAMP display a yellow icon and localhost won't load. Any ideas what that might be? When I comment out error_log everything is fine but PHP errors appear in the Apache log.
                        – thomthom
                        Dec 28 '12 at 1:02










                        up vote
                        4
                        down vote













                        If the error_log directive is set, the file will be used for recording php errors, when it is not set errors will be logged to the Apache log. Take a look at http://us3.php.net/manual/en/errorfunc.configuration.php#ini.error-log.



                        The error_log file and the directory it's in must be writable by the user that Apache is running under. If the file isn't being created, it's probably due to a permissions issue.



                        I don't know for sure why Apache would be crashing on you, but I'm guessing it's a permissions issue of some sort.






                        share|improve this answer






















                        • I stand corrected, thanks. I've edited my answer.
                          – bradym
                          Nov 19 '09 at 16:05














                        up vote
                        4
                        down vote













                        If the error_log directive is set, the file will be used for recording php errors, when it is not set errors will be logged to the Apache log. Take a look at http://us3.php.net/manual/en/errorfunc.configuration.php#ini.error-log.



                        The error_log file and the directory it's in must be writable by the user that Apache is running under. If the file isn't being created, it's probably due to a permissions issue.



                        I don't know for sure why Apache would be crashing on you, but I'm guessing it's a permissions issue of some sort.






                        share|improve this answer






















                        • I stand corrected, thanks. I've edited my answer.
                          – bradym
                          Nov 19 '09 at 16:05












                        up vote
                        4
                        down vote










                        up vote
                        4
                        down vote









                        If the error_log directive is set, the file will be used for recording php errors, when it is not set errors will be logged to the Apache log. Take a look at http://us3.php.net/manual/en/errorfunc.configuration.php#ini.error-log.



                        The error_log file and the directory it's in must be writable by the user that Apache is running under. If the file isn't being created, it's probably due to a permissions issue.



                        I don't know for sure why Apache would be crashing on you, but I'm guessing it's a permissions issue of some sort.






                        share|improve this answer














                        If the error_log directive is set, the file will be used for recording php errors, when it is not set errors will be logged to the Apache log. Take a look at http://us3.php.net/manual/en/errorfunc.configuration.php#ini.error-log.



                        The error_log file and the directory it's in must be writable by the user that Apache is running under. If the file isn't being created, it's probably due to a permissions issue.



                        I don't know for sure why Apache would be crashing on you, but I'm guessing it's a permissions issue of some sort.







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Nov 19 '09 at 16:04

























                        answered Nov 18 '09 at 8:04









                        bradym

                        4,3062134




                        4,3062134











                        • I stand corrected, thanks. I've edited my answer.
                          – bradym
                          Nov 19 '09 at 16:05
















                        • I stand corrected, thanks. I've edited my answer.
                          – bradym
                          Nov 19 '09 at 16:05















                        I stand corrected, thanks. I've edited my answer.
                        – bradym
                        Nov 19 '09 at 16:05




                        I stand corrected, thanks. I've edited my answer.
                        – bradym
                        Nov 19 '09 at 16:05










                        up vote
                        3
                        down vote













                        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 apache configuration files cannot be overridden, so make sure you dont 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






                        share|improve this answer
























                          up vote
                          3
                          down vote













                          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 apache configuration files cannot be overridden, so make sure you dont 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






                          share|improve this answer






















                            up vote
                            3
                            down vote










                            up vote
                            3
                            down vote









                            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 apache configuration files cannot be overridden, so make sure you dont 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






                            share|improve this answer












                            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 apache configuration files cannot be overridden, so make sure you dont 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







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Apr 9 '16 at 8:49









                            Basil Musa

                            3,30253544




                            3,30253544




















                                up vote
                                1
                                down vote













                                I don't understand why, but the error log is now working. Here is what I did. I gave up and commented back out the error_log directive and closed the ini file. I ran the script with the parse error to see of Apache would still crash and I got the PHP error in the log file. This is freaky because the ini file no longer has error_log enabled and my script is not using ini_set().



                                Does anyone have an explanation for this madness? Also, Apache no longer crashes.






                                share|improve this answer
















                                • 2




                                  "Madness" is a pretty good explanation.
                                  – Justin Johnson
                                  Nov 5 '09 at 5:12














                                up vote
                                1
                                down vote













                                I don't understand why, but the error log is now working. Here is what I did. I gave up and commented back out the error_log directive and closed the ini file. I ran the script with the parse error to see of Apache would still crash and I got the PHP error in the log file. This is freaky because the ini file no longer has error_log enabled and my script is not using ini_set().



                                Does anyone have an explanation for this madness? Also, Apache no longer crashes.






                                share|improve this answer
















                                • 2




                                  "Madness" is a pretty good explanation.
                                  – Justin Johnson
                                  Nov 5 '09 at 5:12












                                up vote
                                1
                                down vote










                                up vote
                                1
                                down vote









                                I don't understand why, but the error log is now working. Here is what I did. I gave up and commented back out the error_log directive and closed the ini file. I ran the script with the parse error to see of Apache would still crash and I got the PHP error in the log file. This is freaky because the ini file no longer has error_log enabled and my script is not using ini_set().



                                Does anyone have an explanation for this madness? Also, Apache no longer crashes.






                                share|improve this answer












                                I don't understand why, but the error log is now working. Here is what I did. I gave up and commented back out the error_log directive and closed the ini file. I ran the script with the parse error to see of Apache would still crash and I got the PHP error in the log file. This is freaky because the ini file no longer has error_log enabled and my script is not using ini_set().



                                Does anyone have an explanation for this madness? Also, Apache no longer crashes.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Nov 5 '09 at 4:24









                                Jim

                                121116




                                121116







                                • 2




                                  "Madness" is a pretty good explanation.
                                  – Justin Johnson
                                  Nov 5 '09 at 5:12












                                • 2




                                  "Madness" is a pretty good explanation.
                                  – Justin Johnson
                                  Nov 5 '09 at 5:12







                                2




                                2




                                "Madness" is a pretty good explanation.
                                – Justin Johnson
                                Nov 5 '09 at 5:12




                                "Madness" is a pretty good explanation.
                                – Justin Johnson
                                Nov 5 '09 at 5:12










                                up vote
                                1
                                down vote













                                If you are using Fedora, SELinux (enabled by default) will prevent apache / httpd from appending errors to your log file even when your file is specified in php.ini and its containing directory has all permissions allowed.



                                You can see if this is happening by looking at your system log file in /var/log/messages



                                enter image description here



                                The ideal solution is to configure SELinux to allow access on the log file.



                                The quicker solution is to disable SELinux in /etc/selinux/config by setting SELINUX to disabled.



                                You'll need to reboot your system after doing this for the change to take effect.






                                share|improve this answer


















                                • 1




                                  The advice you gave actually has a website to stop that advice being given. stopdisablingselinux.com
                                  – ʰᵈˑ
                                  Mar 23 '15 at 15:47







                                • 1




                                  I know, hence my writing "ideal." I'm not yet convinced that a home user working locally needs SELinux turned on.
                                  – Anthony
                                  Mar 23 '15 at 19:42














                                up vote
                                1
                                down vote













                                If you are using Fedora, SELinux (enabled by default) will prevent apache / httpd from appending errors to your log file even when your file is specified in php.ini and its containing directory has all permissions allowed.



                                You can see if this is happening by looking at your system log file in /var/log/messages



                                enter image description here



                                The ideal solution is to configure SELinux to allow access on the log file.



                                The quicker solution is to disable SELinux in /etc/selinux/config by setting SELINUX to disabled.



                                You'll need to reboot your system after doing this for the change to take effect.






                                share|improve this answer


















                                • 1




                                  The advice you gave actually has a website to stop that advice being given. stopdisablingselinux.com
                                  – ʰᵈˑ
                                  Mar 23 '15 at 15:47







                                • 1




                                  I know, hence my writing "ideal." I'm not yet convinced that a home user working locally needs SELinux turned on.
                                  – Anthony
                                  Mar 23 '15 at 19:42












                                up vote
                                1
                                down vote










                                up vote
                                1
                                down vote









                                If you are using Fedora, SELinux (enabled by default) will prevent apache / httpd from appending errors to your log file even when your file is specified in php.ini and its containing directory has all permissions allowed.



                                You can see if this is happening by looking at your system log file in /var/log/messages



                                enter image description here



                                The ideal solution is to configure SELinux to allow access on the log file.



                                The quicker solution is to disable SELinux in /etc/selinux/config by setting SELINUX to disabled.



                                You'll need to reboot your system after doing this for the change to take effect.






                                share|improve this answer














                                If you are using Fedora, SELinux (enabled by default) will prevent apache / httpd from appending errors to your log file even when your file is specified in php.ini and its containing directory has all permissions allowed.



                                You can see if this is happening by looking at your system log file in /var/log/messages



                                enter image description here



                                The ideal solution is to configure SELinux to allow access on the log file.



                                The quicker solution is to disable SELinux in /etc/selinux/config by setting SELINUX to disabled.



                                You'll need to reboot your system after doing this for the change to take effect.







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Mar 23 '15 at 19:44

























                                answered Mar 23 '15 at 14:49









                                Anthony

                                392615




                                392615







                                • 1




                                  The advice you gave actually has a website to stop that advice being given. stopdisablingselinux.com
                                  – ʰᵈˑ
                                  Mar 23 '15 at 15:47







                                • 1




                                  I know, hence my writing "ideal." I'm not yet convinced that a home user working locally needs SELinux turned on.
                                  – Anthony
                                  Mar 23 '15 at 19:42












                                • 1




                                  The advice you gave actually has a website to stop that advice being given. stopdisablingselinux.com
                                  – ʰᵈˑ
                                  Mar 23 '15 at 15:47







                                • 1




                                  I know, hence my writing "ideal." I'm not yet convinced that a home user working locally needs SELinux turned on.
                                  – Anthony
                                  Mar 23 '15 at 19:42







                                1




                                1




                                The advice you gave actually has a website to stop that advice being given. stopdisablingselinux.com
                                – ʰᵈˑ
                                Mar 23 '15 at 15:47





                                The advice you gave actually has a website to stop that advice being given. stopdisablingselinux.com
                                – ʰᵈˑ
                                Mar 23 '15 at 15:47





                                1




                                1




                                I know, hence my writing "ideal." I'm not yet convinced that a home user working locally needs SELinux turned on.
                                – Anthony
                                Mar 23 '15 at 19:42




                                I know, hence my writing "ideal." I'm not yet convinced that a home user working locally needs SELinux turned on.
                                – Anthony
                                Mar 23 '15 at 19:42










                                up vote
                                1
                                down vote













                                In my case, on a CentOS development server, after a full yum update the permission on /var/log/http was changed to 700 and the user to 'root', so the user 'apache' wasn't able to enter or write into it. It was still able to write into the existing file /var/log/httpd/error.log but it wasn't able to create a new file, as I use date-suffixed log files.
                                Issuing the command



                                chown apache /var/log/httpd


                                solved the problem.






                                share|improve this answer


























                                  up vote
                                  1
                                  down vote













                                  In my case, on a CentOS development server, after a full yum update the permission on /var/log/http was changed to 700 and the user to 'root', so the user 'apache' wasn't able to enter or write into it. It was still able to write into the existing file /var/log/httpd/error.log but it wasn't able to create a new file, as I use date-suffixed log files.
                                  Issuing the command



                                  chown apache /var/log/httpd


                                  solved the problem.






                                  share|improve this answer
























                                    up vote
                                    1
                                    down vote










                                    up vote
                                    1
                                    down vote









                                    In my case, on a CentOS development server, after a full yum update the permission on /var/log/http was changed to 700 and the user to 'root', so the user 'apache' wasn't able to enter or write into it. It was still able to write into the existing file /var/log/httpd/error.log but it wasn't able to create a new file, as I use date-suffixed log files.
                                    Issuing the command



                                    chown apache /var/log/httpd


                                    solved the problem.






                                    share|improve this answer














                                    In my case, on a CentOS development server, after a full yum update the permission on /var/log/http was changed to 700 and the user to 'root', so the user 'apache' wasn't able to enter or write into it. It was still able to write into the existing file /var/log/httpd/error.log but it wasn't able to create a new file, as I use date-suffixed log files.
                                    Issuing the command



                                    chown apache /var/log/httpd


                                    solved the problem.







                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited Sep 21 '17 at 17:15









                                    Alex M

                                    2,33471928




                                    2,33471928










                                    answered Sep 21 '17 at 16:40









                                    Zoltan M

                                    312




                                    312




















                                        up vote
                                        0
                                        down vote













                                        As bradym said, check whether you have write permissions to the directory where you php error log is located for apache user. If you created a log file with written permissions it's not enough, the dir should have them too.






                                        share|improve this answer
























                                          up vote
                                          0
                                          down vote













                                          As bradym said, check whether you have write permissions to the directory where you php error log is located for apache user. If you created a log file with written permissions it's not enough, the dir should have them too.






                                          share|improve this answer






















                                            up vote
                                            0
                                            down vote










                                            up vote
                                            0
                                            down vote









                                            As bradym said, check whether you have write permissions to the directory where you php error log is located for apache user. If you created a log file with written permissions it's not enough, the dir should have them too.






                                            share|improve this answer












                                            As bradym said, check whether you have write permissions to the directory where you php error log is located for apache user. If you created a log file with written permissions it's not enough, the dir should have them too.







                                            share|improve this answer












                                            share|improve this answer



                                            share|improve this answer










                                            answered Dec 10 '10 at 14:44









                                            Łukasz Frankowski

                                            1,7871722




                                            1,7871722




















                                                up vote
                                                0
                                                down vote













                                                The error_log = "C:phpLogerror.log" was not working for me either. The solution for me was that you shouldn't create the error.log yourself, because PHP will do it for you. See the PHP message board. I'm using PHP 5.2 on a Windows 2008 server






                                                share|improve this answer
























                                                  up vote
                                                  0
                                                  down vote













                                                  The error_log = "C:phpLogerror.log" was not working for me either. The solution for me was that you shouldn't create the error.log yourself, because PHP will do it for you. See the PHP message board. I'm using PHP 5.2 on a Windows 2008 server






                                                  share|improve this answer






















                                                    up vote
                                                    0
                                                    down vote










                                                    up vote
                                                    0
                                                    down vote









                                                    The error_log = "C:phpLogerror.log" was not working for me either. The solution for me was that you shouldn't create the error.log yourself, because PHP will do it for you. See the PHP message board. I'm using PHP 5.2 on a Windows 2008 server






                                                    share|improve this answer












                                                    The error_log = "C:phpLogerror.log" was not working for me either. The solution for me was that you shouldn't create the error.log yourself, because PHP will do it for you. See the PHP message board. I'm using PHP 5.2 on a Windows 2008 server







                                                    share|improve this answer












                                                    share|improve this answer



                                                    share|improve this answer










                                                    answered Jul 28 '11 at 8:50









                                                    Cerveser

                                                    527618




                                                    527618




















                                                        up vote
                                                        0
                                                        down vote













                                                        The way it works on my ubuntu (Apache 2.4.7, PHP 5.5.9) is the following:



                                                        command line script:



                                                        • writes the log into the path pointed by error_log if log_errors = On. Settings in /etc/php5/cli/php.ini;

                                                        web request via apache:



                                                        • if log_errors = On (/etc/php5/apache2/php.ini), the error appended into the path pointed by ErrorLog apache directive in the virtualhost. If that directive does not exist, the php.ini error_log path is used;

                                                        • if log_errors = Off not logs are written anywhere;

                                                        As far as I remember, it almost worked this way in most of the linux stacks






                                                        share|improve this answer
























                                                          up vote
                                                          0
                                                          down vote













                                                          The way it works on my ubuntu (Apache 2.4.7, PHP 5.5.9) is the following:



                                                          command line script:



                                                          • writes the log into the path pointed by error_log if log_errors = On. Settings in /etc/php5/cli/php.ini;

                                                          web request via apache:



                                                          • if log_errors = On (/etc/php5/apache2/php.ini), the error appended into the path pointed by ErrorLog apache directive in the virtualhost. If that directive does not exist, the php.ini error_log path is used;

                                                          • if log_errors = Off not logs are written anywhere;

                                                          As far as I remember, it almost worked this way in most of the linux stacks






                                                          share|improve this answer






















                                                            up vote
                                                            0
                                                            down vote










                                                            up vote
                                                            0
                                                            down vote









                                                            The way it works on my ubuntu (Apache 2.4.7, PHP 5.5.9) is the following:



                                                            command line script:



                                                            • writes the log into the path pointed by error_log if log_errors = On. Settings in /etc/php5/cli/php.ini;

                                                            web request via apache:



                                                            • if log_errors = On (/etc/php5/apache2/php.ini), the error appended into the path pointed by ErrorLog apache directive in the virtualhost. If that directive does not exist, the php.ini error_log path is used;

                                                            • if log_errors = Off not logs are written anywhere;

                                                            As far as I remember, it almost worked this way in most of the linux stacks






                                                            share|improve this answer












                                                            The way it works on my ubuntu (Apache 2.4.7, PHP 5.5.9) is the following:



                                                            command line script:



                                                            • writes the log into the path pointed by error_log if log_errors = On. Settings in /etc/php5/cli/php.ini;

                                                            web request via apache:



                                                            • if log_errors = On (/etc/php5/apache2/php.ini), the error appended into the path pointed by ErrorLog apache directive in the virtualhost. If that directive does not exist, the php.ini error_log path is used;

                                                            • if log_errors = Off not logs are written anywhere;

                                                            As far as I remember, it almost worked this way in most of the linux stacks







                                                            share|improve this answer












                                                            share|improve this answer



                                                            share|improve this answer










                                                            answered Oct 17 '14 at 11:16









                                                            Elvis Ciotti

                                                            3,62311517




                                                            3,62311517




















                                                                up vote
                                                                0
                                                                down vote













                                                                This did the trick for me.



                                                                setsebool -P httpd_unified 1


                                                                Please note, this would be the preferred method below to try first:



                                                                semanage fcontext -a -t httpd_sys_rw_content_t 'errorLogNameHere.error.log
                                                                restorecon -v 'errorLogNameHere.error.log'


                                                                This answer was derived from the logs from executing this command line:



                                                                journalctl -xe 


                                                                Further information on the system I was running on:
                                                                PHP 7.0 and
                                                                CentOS 7



                                                                Not sure if it's not obvious, but the issue was Apache's configuration to writing files. I did try chmod 777, chmod a+w on the logging directory, but this didn't work for me.



                                                                Hope this can help somebody.






                                                                share|improve this answer
























                                                                  up vote
                                                                  0
                                                                  down vote













                                                                  This did the trick for me.



                                                                  setsebool -P httpd_unified 1


                                                                  Please note, this would be the preferred method below to try first:



                                                                  semanage fcontext -a -t httpd_sys_rw_content_t 'errorLogNameHere.error.log
                                                                  restorecon -v 'errorLogNameHere.error.log'


                                                                  This answer was derived from the logs from executing this command line:



                                                                  journalctl -xe 


                                                                  Further information on the system I was running on:
                                                                  PHP 7.0 and
                                                                  CentOS 7



                                                                  Not sure if it's not obvious, but the issue was Apache's configuration to writing files. I did try chmod 777, chmod a+w on the logging directory, but this didn't work for me.



                                                                  Hope this can help somebody.






                                                                  share|improve this answer






















                                                                    up vote
                                                                    0
                                                                    down vote










                                                                    up vote
                                                                    0
                                                                    down vote









                                                                    This did the trick for me.



                                                                    setsebool -P httpd_unified 1


                                                                    Please note, this would be the preferred method below to try first:



                                                                    semanage fcontext -a -t httpd_sys_rw_content_t 'errorLogNameHere.error.log
                                                                    restorecon -v 'errorLogNameHere.error.log'


                                                                    This answer was derived from the logs from executing this command line:



                                                                    journalctl -xe 


                                                                    Further information on the system I was running on:
                                                                    PHP 7.0 and
                                                                    CentOS 7



                                                                    Not sure if it's not obvious, but the issue was Apache's configuration to writing files. I did try chmod 777, chmod a+w on the logging directory, but this didn't work for me.



                                                                    Hope this can help somebody.






                                                                    share|improve this answer












                                                                    This did the trick for me.



                                                                    setsebool -P httpd_unified 1


                                                                    Please note, this would be the preferred method below to try first:



                                                                    semanage fcontext -a -t httpd_sys_rw_content_t 'errorLogNameHere.error.log
                                                                    restorecon -v 'errorLogNameHere.error.log'


                                                                    This answer was derived from the logs from executing this command line:



                                                                    journalctl -xe 


                                                                    Further information on the system I was running on:
                                                                    PHP 7.0 and
                                                                    CentOS 7



                                                                    Not sure if it's not obvious, but the issue was Apache's configuration to writing files. I did try chmod 777, chmod a+w on the logging directory, but this didn't work for me.



                                                                    Hope this can help somebody.







                                                                    share|improve this answer












                                                                    share|improve this answer



                                                                    share|improve this answer










                                                                    answered Nov 12 '17 at 8:59









                                                                    fungusanthrax

                                                                    12610




                                                                    12610




















                                                                        up vote
                                                                        0
                                                                        down vote













                                                                        Here is my troubleshooting guide to error_log() calls not working.




                                                                        1. Look at your server's configuration to find out where the default error log file is.



                                                                          This depends on which server you're using. To get you started, have a look at Apache's ErrorLog option if you're using Apache or Nginx's error_log option if you're using Nginx. Make sure it is set to a file. If you're using a tool like Valet, note that it's using server software like Nginx behind the scenes.




                                                                        2. Check the permissions of your server's error log file.



                                                                          On Unix-like systems, it should be writeable by the correct user and group, and the permissions of the parent directory and all its ancestors need to be correct as well. Use chmod and chown.




                                                                        3. Check the configuration of PHP in the .ini files.



                                                                          Specifically, check for log_errors = On and error_reporting = E_ALL | E_STRICT and error_log = /tmp/example/php_errors.log (see docs for log_errors, error_reporting and error_log configuration settings). To find the .ini file, look at the output of phpinfo();. If error_log is not set, by default it goes to the error log for the server, mentioned in the previous steps. If error_log is set to a file, it should already exist and be writeable, just like in previous steps. Remember to restart the server after configuration changes.




                                                                        4. Check that PHP's settings aren't being changed by server configuration.



                                                                          Your server's configuration (even .htaccess) can change PHP configuration settings. In Apache, this is done using php_admin_value and php_admin_flag (docs). For instance, you may find in your .htaccess file this line: php_admin_flag[log_errors] = off. Remember to restart the server after configuration changes.



                                                                          At this point, you should be able to create a test file test.php with the contents <?php error_log("test");, restart your server, and open the URL in your browser, and you should be able to see test in your error log (either the server's, or the one specified by error_log =). But keep reading.




                                                                        5. Check that PHP's settings aren't being changed at run-time.



                                                                          The log_errors option can be changed at runtime by running ini_set('log_errors', 1);, and so can the other configuration options error_reporting and error_log. Also note there is a special error_reporting() PHP function which changes the configuration at run-time. Search your code-base for any invocations of ini_set or error_reporting. WordPress for example does run these depending on the value of WP_DEBUG.



                                                                        Other things to look at: You may be having permission issues in SELinux (see this answer).






                                                                        share|improve this answer
























                                                                          up vote
                                                                          0
                                                                          down vote













                                                                          Here is my troubleshooting guide to error_log() calls not working.




                                                                          1. Look at your server's configuration to find out where the default error log file is.



                                                                            This depends on which server you're using. To get you started, have a look at Apache's ErrorLog option if you're using Apache or Nginx's error_log option if you're using Nginx. Make sure it is set to a file. If you're using a tool like Valet, note that it's using server software like Nginx behind the scenes.




                                                                          2. Check the permissions of your server's error log file.



                                                                            On Unix-like systems, it should be writeable by the correct user and group, and the permissions of the parent directory and all its ancestors need to be correct as well. Use chmod and chown.




                                                                          3. Check the configuration of PHP in the .ini files.



                                                                            Specifically, check for log_errors = On and error_reporting = E_ALL | E_STRICT and error_log = /tmp/example/php_errors.log (see docs for log_errors, error_reporting and error_log configuration settings). To find the .ini file, look at the output of phpinfo();. If error_log is not set, by default it goes to the error log for the server, mentioned in the previous steps. If error_log is set to a file, it should already exist and be writeable, just like in previous steps. Remember to restart the server after configuration changes.




                                                                          4. Check that PHP's settings aren't being changed by server configuration.



                                                                            Your server's configuration (even .htaccess) can change PHP configuration settings. In Apache, this is done using php_admin_value and php_admin_flag (docs). For instance, you may find in your .htaccess file this line: php_admin_flag[log_errors] = off. Remember to restart the server after configuration changes.



                                                                            At this point, you should be able to create a test file test.php with the contents <?php error_log("test");, restart your server, and open the URL in your browser, and you should be able to see test in your error log (either the server's, or the one specified by error_log =). But keep reading.




                                                                          5. Check that PHP's settings aren't being changed at run-time.



                                                                            The log_errors option can be changed at runtime by running ini_set('log_errors', 1);, and so can the other configuration options error_reporting and error_log. Also note there is a special error_reporting() PHP function which changes the configuration at run-time. Search your code-base for any invocations of ini_set or error_reporting. WordPress for example does run these depending on the value of WP_DEBUG.



                                                                          Other things to look at: You may be having permission issues in SELinux (see this answer).






                                                                          share|improve this answer






















                                                                            up vote
                                                                            0
                                                                            down vote










                                                                            up vote
                                                                            0
                                                                            down vote









                                                                            Here is my troubleshooting guide to error_log() calls not working.




                                                                            1. Look at your server's configuration to find out where the default error log file is.



                                                                              This depends on which server you're using. To get you started, have a look at Apache's ErrorLog option if you're using Apache or Nginx's error_log option if you're using Nginx. Make sure it is set to a file. If you're using a tool like Valet, note that it's using server software like Nginx behind the scenes.




                                                                            2. Check the permissions of your server's error log file.



                                                                              On Unix-like systems, it should be writeable by the correct user and group, and the permissions of the parent directory and all its ancestors need to be correct as well. Use chmod and chown.




                                                                            3. Check the configuration of PHP in the .ini files.



                                                                              Specifically, check for log_errors = On and error_reporting = E_ALL | E_STRICT and error_log = /tmp/example/php_errors.log (see docs for log_errors, error_reporting and error_log configuration settings). To find the .ini file, look at the output of phpinfo();. If error_log is not set, by default it goes to the error log for the server, mentioned in the previous steps. If error_log is set to a file, it should already exist and be writeable, just like in previous steps. Remember to restart the server after configuration changes.




                                                                            4. Check that PHP's settings aren't being changed by server configuration.



                                                                              Your server's configuration (even .htaccess) can change PHP configuration settings. In Apache, this is done using php_admin_value and php_admin_flag (docs). For instance, you may find in your .htaccess file this line: php_admin_flag[log_errors] = off. Remember to restart the server after configuration changes.



                                                                              At this point, you should be able to create a test file test.php with the contents <?php error_log("test");, restart your server, and open the URL in your browser, and you should be able to see test in your error log (either the server's, or the one specified by error_log =). But keep reading.




                                                                            5. Check that PHP's settings aren't being changed at run-time.



                                                                              The log_errors option can be changed at runtime by running ini_set('log_errors', 1);, and so can the other configuration options error_reporting and error_log. Also note there is a special error_reporting() PHP function which changes the configuration at run-time. Search your code-base for any invocations of ini_set or error_reporting. WordPress for example does run these depending on the value of WP_DEBUG.



                                                                            Other things to look at: You may be having permission issues in SELinux (see this answer).






                                                                            share|improve this answer












                                                                            Here is my troubleshooting guide to error_log() calls not working.




                                                                            1. Look at your server's configuration to find out where the default error log file is.



                                                                              This depends on which server you're using. To get you started, have a look at Apache's ErrorLog option if you're using Apache or Nginx's error_log option if you're using Nginx. Make sure it is set to a file. If you're using a tool like Valet, note that it's using server software like Nginx behind the scenes.




                                                                            2. Check the permissions of your server's error log file.



                                                                              On Unix-like systems, it should be writeable by the correct user and group, and the permissions of the parent directory and all its ancestors need to be correct as well. Use chmod and chown.




                                                                            3. Check the configuration of PHP in the .ini files.



                                                                              Specifically, check for log_errors = On and error_reporting = E_ALL | E_STRICT and error_log = /tmp/example/php_errors.log (see docs for log_errors, error_reporting and error_log configuration settings). To find the .ini file, look at the output of phpinfo();. If error_log is not set, by default it goes to the error log for the server, mentioned in the previous steps. If error_log is set to a file, it should already exist and be writeable, just like in previous steps. Remember to restart the server after configuration changes.




                                                                            4. Check that PHP's settings aren't being changed by server configuration.



                                                                              Your server's configuration (even .htaccess) can change PHP configuration settings. In Apache, this is done using php_admin_value and php_admin_flag (docs). For instance, you may find in your .htaccess file this line: php_admin_flag[log_errors] = off. Remember to restart the server after configuration changes.



                                                                              At this point, you should be able to create a test file test.php with the contents <?php error_log("test");, restart your server, and open the URL in your browser, and you should be able to see test in your error log (either the server's, or the one specified by error_log =). But keep reading.




                                                                            5. Check that PHP's settings aren't being changed at run-time.



                                                                              The log_errors option can be changed at runtime by running ini_set('log_errors', 1);, and so can the other configuration options error_reporting and error_log. Also note there is a special error_reporting() PHP function which changes the configuration at run-time. Search your code-base for any invocations of ini_set or error_reporting. WordPress for example does run these depending on the value of WP_DEBUG.



                                                                            Other things to look at: You may be having permission issues in SELinux (see this answer).







                                                                            share|improve this answer












                                                                            share|improve this answer



                                                                            share|improve this answer










                                                                            answered Nov 8 at 11:16









                                                                            Flimm

                                                                            48.6k23130151




                                                                            48.6k23130151




















                                                                                up vote
                                                                                -3
                                                                                down vote













                                                                                Make sure and also set



                                                                                display_errors = On


                                                                                And try



                                                                                 error_reporting(E_ALL);


                                                                                In your code. Often times I include a runtime error config script that turns errors on when I'm developing, and turns them back off when I'm not. It looks something roughly like this:



                                                                                if ($debugmode == 'on') 
                                                                                error_reporting(E_ALL);
                                                                                ini_set("display_errors", 1);
                                                                                else
                                                                                error_reporting(0);
                                                                                ini_set("display_errors", 0);



                                                                                Hope this helps.



                                                                                ** I didn't read that correctly, you want to log errors instead of display, in that case Chaos' answer is what you're looking for.






                                                                                share|improve this answer
















                                                                                • 6




                                                                                  then please delete this post.
                                                                                  – mauris
                                                                                  Nov 5 '09 at 2:58






                                                                                • 1




                                                                                  Hi Jeremy, thanks for the help. :)
                                                                                  – Jim
                                                                                  Nov 5 '09 at 3:03










                                                                                • then please either delete the post as @mauris said, or make a better edit: starting stating (ans emphasized please) that this doesn't answer to OP's question but to something else in case you've landed here because of that...
                                                                                  – Erdal G.
                                                                                  Mar 20 at 13:59














                                                                                up vote
                                                                                -3
                                                                                down vote













                                                                                Make sure and also set



                                                                                display_errors = On


                                                                                And try



                                                                                 error_reporting(E_ALL);


                                                                                In your code. Often times I include a runtime error config script that turns errors on when I'm developing, and turns them back off when I'm not. It looks something roughly like this:



                                                                                if ($debugmode == 'on') 
                                                                                error_reporting(E_ALL);
                                                                                ini_set("display_errors", 1);
                                                                                else
                                                                                error_reporting(0);
                                                                                ini_set("display_errors", 0);



                                                                                Hope this helps.



                                                                                ** I didn't read that correctly, you want to log errors instead of display, in that case Chaos' answer is what you're looking for.






                                                                                share|improve this answer
















                                                                                • 6




                                                                                  then please delete this post.
                                                                                  – mauris
                                                                                  Nov 5 '09 at 2:58






                                                                                • 1




                                                                                  Hi Jeremy, thanks for the help. :)
                                                                                  – Jim
                                                                                  Nov 5 '09 at 3:03










                                                                                • then please either delete the post as @mauris said, or make a better edit: starting stating (ans emphasized please) that this doesn't answer to OP's question but to something else in case you've landed here because of that...
                                                                                  – Erdal G.
                                                                                  Mar 20 at 13:59












                                                                                up vote
                                                                                -3
                                                                                down vote










                                                                                up vote
                                                                                -3
                                                                                down vote









                                                                                Make sure and also set



                                                                                display_errors = On


                                                                                And try



                                                                                 error_reporting(E_ALL);


                                                                                In your code. Often times I include a runtime error config script that turns errors on when I'm developing, and turns them back off when I'm not. It looks something roughly like this:



                                                                                if ($debugmode == 'on') 
                                                                                error_reporting(E_ALL);
                                                                                ini_set("display_errors", 1);
                                                                                else
                                                                                error_reporting(0);
                                                                                ini_set("display_errors", 0);



                                                                                Hope this helps.



                                                                                ** I didn't read that correctly, you want to log errors instead of display, in that case Chaos' answer is what you're looking for.






                                                                                share|improve this answer












                                                                                Make sure and also set



                                                                                display_errors = On


                                                                                And try



                                                                                 error_reporting(E_ALL);


                                                                                In your code. Often times I include a runtime error config script that turns errors on when I'm developing, and turns them back off when I'm not. It looks something roughly like this:



                                                                                if ($debugmode == 'on') 
                                                                                error_reporting(E_ALL);
                                                                                ini_set("display_errors", 1);
                                                                                else
                                                                                error_reporting(0);
                                                                                ini_set("display_errors", 0);



                                                                                Hope this helps.



                                                                                ** I didn't read that correctly, you want to log errors instead of display, in that case Chaos' answer is what you're looking for.







                                                                                share|improve this answer












                                                                                share|improve this answer



                                                                                share|improve this answer










                                                                                answered Nov 5 '09 at 2:54









                                                                                Jeremy Morgan

                                                                                2,7771721




                                                                                2,7771721







                                                                                • 6




                                                                                  then please delete this post.
                                                                                  – mauris
                                                                                  Nov 5 '09 at 2:58






                                                                                • 1




                                                                                  Hi Jeremy, thanks for the help. :)
                                                                                  – Jim
                                                                                  Nov 5 '09 at 3:03










                                                                                • then please either delete the post as @mauris said, or make a better edit: starting stating (ans emphasized please) that this doesn't answer to OP's question but to something else in case you've landed here because of that...
                                                                                  – Erdal G.
                                                                                  Mar 20 at 13:59












                                                                                • 6




                                                                                  then please delete this post.
                                                                                  – mauris
                                                                                  Nov 5 '09 at 2:58






                                                                                • 1




                                                                                  Hi Jeremy, thanks for the help. :)
                                                                                  – Jim
                                                                                  Nov 5 '09 at 3:03










                                                                                • then please either delete the post as @mauris said, or make a better edit: starting stating (ans emphasized please) that this doesn't answer to OP's question but to something else in case you've landed here because of that...
                                                                                  – Erdal G.
                                                                                  Mar 20 at 13:59







                                                                                6




                                                                                6




                                                                                then please delete this post.
                                                                                – mauris
                                                                                Nov 5 '09 at 2:58




                                                                                then please delete this post.
                                                                                – mauris
                                                                                Nov 5 '09 at 2:58




                                                                                1




                                                                                1




                                                                                Hi Jeremy, thanks for the help. :)
                                                                                – Jim
                                                                                Nov 5 '09 at 3:03




                                                                                Hi Jeremy, thanks for the help. :)
                                                                                – Jim
                                                                                Nov 5 '09 at 3:03












                                                                                then please either delete the post as @mauris said, or make a better edit: starting stating (ans emphasized please) that this doesn't answer to OP's question but to something else in case you've landed here because of that...
                                                                                – Erdal G.
                                                                                Mar 20 at 13:59




                                                                                then please either delete the post as @mauris said, or make a better edit: starting stating (ans emphasized please) that this doesn't answer to OP's question but to something else in case you've landed here because of that...
                                                                                – Erdal G.
                                                                                Mar 20 at 13:59

















                                                                                 

                                                                                draft saved


                                                                                draft discarded















































                                                                                 


                                                                                draft saved


                                                                                draft discarded














                                                                                StackExchange.ready(
                                                                                function ()
                                                                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f1678009%2fphp-error-log-not-working%23new-answer', 'question_page');

                                                                                );

                                                                                Post as a guest














































































                                                                                Popular posts from this blog

                                                                                𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

                                                                                Crossroads (UK TV series)

                                                                                ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế