+ Reply to Thread
Results 1 to 7 of 7

Thread: PHP error_log - WTF?

  1. #1
    beano is offline New Bee
    Join Date
    Jun 2008
    Posts
    12
    WHB Points this Month
    0.00
    WHB Points
    0.00
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP error_log - WTF?

    Hey, I realised one of my sites was using about 10 times the space it usually does the other day.

    When I found the source of the problem it was a 60 MB file called error_log in the public_html directory.

    The file's called error_log and seems to be something that PHP's doing automatically. I've almost certainly configured something to do this somewhere but I can't remember how or what or where. Can anyone help?!

  2. #2
    omniuni's Avatar
    omniuni is offline Jewbergeek!
    Join Date
    Jul 2007
    Posts
    181
    WHB Points this Month
    0.00
    WHB Points
    0.00
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes, php does keep an error log. If it's 60 MB, then you've probably got a major issue with your php script! That's a 60 megabyte text file!!!

    First, you can safely delete that log file. Next, create a blank file called testme.php and upload it to the server. in the file, but the following line:

    <?php include('idontexist.blah'); ?>

    go to your website /testme.php and see if it outputs the error to the web page. (It should say something to the effect of "there is no such file as idontexist.blah")

    If you don't see an error, PHP is outputting to a text file, not to the page, which is probably why your log is so big.

    Once we know this, we should be able to go on from there to fix the problem.
    [URL="http://d-site.net"]http://d-site.net/[/URL]

  3. #3
    PsyCHZZZ's Avatar
    PsyCHZZZ is offline aspiring dreamer~
    Join Date
    Dec 2006
    Location
    Tokyo, Japan.
    Posts
    142
    WHB Points this Month
    0.00
    WHB Points
    0.00
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Have you reviewed the error_log file? Perhaps you can find out which script is causing the problem (usually included in the error_log description) and fixing the issue on the script will solve this problem.

    You can also look into creating your own php.ini file or just using ini_set() for specific PHP script to control how you want the error messages to be managed.

    Ref Link :
    http://www.php.net/manual/en/function.ini-set.php
    http://www.php.net/manual/en/errorfu...figuration.php

  4. #4
    beano is offline New Bee
    Join Date
    Jun 2008
    Posts
    12
    WHB Points this Month
    0.00
    WHB Points
    0.00
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the help guys. I'm not particularly bothered about any of the errors that are showing up (technically I suppose they're warnings rather than errors), but I've noticed today this seems to be happening across all my sites.

    I'm getting error_log files all over the place, so I'm guessing it's something that WHB turns on by default that my previous hosts didn't (I just moved here in May and have been on holiday for the first 2 weeks of June).

    phpinfo() says log_errors is "On" so I guess I'll try disabling that with ini-set.

  5. #5
    Alan B's Avatar
    Alan B is offline Super Moderator
    Join Date
    Jul 2007
    Location
    Toronto, Canada
    Posts
    1,386
    WHB Points this Month
    0.00
    WHB Points
    290.00
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default

    Maybe there's a way you can set a size limit for the error log.

  6. #6
    beano is offline New Bee
    Join Date
    Jun 2008
    Posts
    12
    WHB Points this Month
    0.00
    WHB Points
    0.00
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Apparently I can disable it by creating a php.ini file in every directory on every site and setting the value
    log_errors = 'Off';

    But that's hardly satisfactory.

    Never got round to getting this sorted but it could be a security hole apparently:

    http://blog.taragana.com/index.php/a...-in-error_log/

    Is it not a bit silly to log errors unless users specifically tell their scripts not too? It must be such a waste. Is there not a case to change the servers php.ini file to default to NOT logging errors?
    Last edited by beano; 08-07-2008 at 10:21 AM.

  7. #7
    Alan B's Avatar
    Alan B is offline Super Moderator
    Join Date
    Jul 2007
    Location
    Toronto, Canada
    Posts
    1,386
    WHB Points this Month
    0.00
    WHB Points
    290.00
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default

    Perhaps WHB Support could comment about the potential vulnerability and about ways to limit the size of the log files.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts