Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Oct 2011
    Posts
    236
    Thanks
    11
    Thanked 5 Times in 5 Posts

    How to stop website writing error logs

    Hi

    I know this is not practical and should not be done. My friends website is written in php4 and alot of his functions are depreciated in php5.3.

    His website still works on his server 100% but its chucking alot of error reports to the server.

    He doesnt want me to rewrite the site which is pretty big as he has no money and personally i have no time at the moment.

    He has stated that he just wants to make the site to stop sending errors to the errors log on the server, it can run up alot in a year and he wants to stop it rather than spending time doing it every month.

    Is there a function like error_log(NULL); which i can just put at the top of every page to prevent this from happening.

    I have looked on php.net but to nothing there.

    Also if i cant do this, if i make a php.ini file and upload it to sever and just add the lines:

    log_errors = Off

    Will that work?

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    I'd check what the current php error logging settings are for his account. You can see that by running a php file with phpinfo() in it. And then as you mentioned you can override the error logging directive in the master PHP ini file with the local copy of the php.ini file.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    Regular Coder
    Join Date
    Oct 2011
    Posts
    236
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by Spookster View Post
    I'd check what the current php error logging settings are for his account. You can see that by running a php file with phpinfo() in it. And then as you mentioned you can override the error logging directive in the master PHP ini file with the local copy of the php.ini file.
    As the website is hosted on a shared hosting account the mast php.ini is not available for access. So it would need to be done within a setup php.ini uploaded into the public_html section.

    Can this be done?

  • #4
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    Quote Originally Posted by Spookster View Post
    I'd check what the current php error logging settings are for his account. You can see that by running a php file with phpinfo() in it. And then as you mentioned you can override the error logging directive in the master PHP ini file with the local copy of the php.ini file.
    I would contact your web host for advice though.
    Last edited by BluePanther; 01-10-2012 at 09:17 AM.
    Useful function to retrieve difference in times
    The best PHP resource
    A good PHP FAQ
    PLEASE remember to wrap your code in [PHP] tags.
    PHP Code:
    // Replace this
    if(isset($_POST['submitButton']))
    // With this
    if(!empty($_POST))
    // Then check for values/forms. Some IE versions don't send the submit button 
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

  • #5
    Regular Coder
    Join Date
    Oct 2011
    Posts
    236
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by BluePanther View Post
    I would contact your web host for advice though.
    His host is within america and would cost a fortune to ring, as i am not getting paid and only helping out i would not want to ring lol and what ive been told the email support is not responsive lol..

    You stated check the error log in the phpinfo function which i have,

    The function shows:

    error_log => local value= "no value" & master calue = "no value"
    log_errors = on

    would i setup a php.ini with the error_log = Off within it?

    What information would that say on how its setup?

    Thanks
    Last edited by devinmaking; 01-10-2012 at 09:55 AM.


  •  

    Posting Permissions

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