Creating/updating error log in root?

UKSBD

Moderator
  • Dec 30, 2005
    13,041
    1
    2,837
    Using cPanel I used to have it set so it created an error log in the root recording all errors which automatically updated with every error.

    Found this really useful when testing, but I must have switched it off and can't remember how

    I have log_errors = On in thephp.ini file but how do i switch on so an error log file is just created in the root which I can FTP?
     

    WESH.UK

    Free Member
  • Aug 11, 2018
    142
    40
    Greater London
    wesh.uk
    It's automatic. If there are errors, a log file will appear in whichever directories have errors.

    You shouldn't need to enable log_errors in your ini file.

    You can also open the file from cPanel > File Manager too, saves downloading it.

    From the cPanel File Manager, do a search for "error_log" and it will go find any log files and show you where they are, so you can check whats having issues.

    On all of our cPanel servers, the log files are automatic, nobody ever needs to worry about having them enabled, they will show up only where there are errors, automatically.
     
    Upvote 0

    WESH.UK

    Free Member
  • Aug 11, 2018
    142
    40
    Greater London
    wesh.uk
    Have a word with your hosting firm, as its a pretty crappy thing to do, to switch them off.

    If they havent disabled them, then either you have no errors, or something in your .ini file is preventing them being auto-created.

    They only appear if there are errors. If you delete it, and a new one doesnt re-appear, then there are no errors to log.
     
    Upvote 0

    fisicx

    Moderator
    Sep 12, 2006
    46,866
    8
    15,482
    Aldershot
    www.aerin.co.uk
    In php you can suppress error reporting. Have you maybe done this yourself?
     
    Upvote 0

    UKSBD

    Moderator
  • Dec 30, 2005
    13,041
    1
    2,837
    Although my server no longer creates (and updates) an error_log file in every directory, it does update a text file error log in a logs directory and also creates a monthly .gz that I can download.

    This is actually far better for me than creating lots of separate error logs in individual directories, so all is fine now :)

    Big help as I have been putting off moving to PHP 8 due to a couple of problems and found out (with help from error logs) that something that was working in php 7.4 wasn't in 8.3 due to a cases sensitivity issue (was using tblCompany instead of tblcompany)
     
    Upvote 0

    Latest Articles

    Join UK Business Forums for free business advice