1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Hide PHP error help

Discussion in 'PHP' started by Zoti Media Group, Oct 3, 2015.

  1. #1
    Hello coders!

    I want to hide a php error shown in a script.
    Am adding this code in the first line in php:
    error_reporting(0);

    Also many other variants of this code.

    The problem:
    When I add this line the PHP error is not showing any more but on the header of the site this code shows:
    error_reporting(0);

    I wave tried to disable php errors only for this site via httpd.conf without success.
    Tried via php.ini and .htaccess also without success!

    @digitalpoint any idea?

    Thank you everyone!
     
    Zoti Media Group, Oct 3, 2015 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    I'd say you have the error reporting statement in the plain html, rather than in a php section

    The other way you could do it is with ob_start() etc to catch the error and dump it.

    I'd prefer to have the error handled properly though. Even with a try() statement
     
    sarahk, Oct 3, 2015 IP
  3. Zoti Media Group

    Zoti Media Group Notable Member

    Messages:
    1,598
    Likes Received:
    113
    Best Answers:
    2
    Trophy Points:
    265
    Digital Goods:
    2
    #3
    Hi Sarah.

    It could not be in html because the error is not showing after adding that code on the beginning of the script.
    But anyway, could you please explain where and how to use your code/option?
    Am not skilled on php that much
    Thank you!
     
    Zoti Media Group, Oct 3, 2015 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #4
    How about you paste a bit of your code, including the bit with the error you are trying to hide. remember to use the bbcode!
     
    sarahk, Oct 3, 2015 IP
  5. Zoti Media Group

    Zoti Media Group Notable Member

    Messages:
    1,598
    Likes Received:
    113
    Best Answers:
    2
    Trophy Points:
    265
    Digital Goods:
    2
    #5
    Am on mobile now. Will do it tomorrow when I wake-up (its 01:50 AM here).
     
    Zoti Media Group, Oct 3, 2015 IP
  6. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #6
    Hiding an error is just disguising the problem. The correct approach would be to eliminate the error.
     
    PoPSiCLe, Oct 3, 2015 IP
    sarahk likes this.
  7. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #7
    Yeah, why are you trying to hide the error, instead of, oh I don't know... FIX THE BLOODY PROBLEM?!?

    :/
     
    deathshadow, Oct 4, 2015 IP
    sarahk likes this.
  8. Keteki

    Keteki Active Member

    Messages:
    112
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #8
    error_reporting(0);
    ini_set('display_errors', 0);
    Code (markup):
    Try This...
     
    Keteki, Oct 9, 2015 IP