SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unable to turn off notice errors in php 5.3.2

    Hi everyone,

    I recently migrated to PHP 5.3.2, and realized that I am unable to turn off notice errors in my site now. I went to php.ini, and in these lines:

    Code:
    ; Common Values:
    ;   E_ALL & ~E_NOTICE  (Show all errors, except for notices and coding standards warnings.)
    ;   E_ALL & ~E_NOTICE | E_STRICT  (Show all errors, except for notices)
    ;   E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (Show only errors)
    ;   E_ALL | E_STRICT  (Show all errors, warnings and notices including coding standards.)
    ; Default Value: E_ALL & ~E_NOTICE
    ; Development Value: E_ALL | E_STRICT
    ; Production Value: E_ALL & ~E_DEPRECATED
    ; http://php.net/error-reporting
    error_reporting = E_ALL & ~E_NOTICE
    ...I've tried setting everything (and I restart apache each time), but I am unable to get rid of notices.

    The only way I'm able to get rid of notice errors is by setting :

    Code:
    display_errors = Off
    That is, of course, not something I can do since I need to see errors to fix them, and I would like to see errors on the webpage that I am coding rather than log them somewhere.

    Can someone help? Is this a bug in PHP 5.3.2 or something I am doing wrong?

    Thank you very much for your time!

    P. S. Also, would anyone know how I can get PHP 5.3.2 to support the .php3 extension?

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Since you're obviously editing a correct php.ini file(evidenced by display_errors setting working), you must have something overriding the error_reporting level somewhere else.

    Do a phpinfo() and look for the string ini, it might reveal additional config files being used. Also, it might be set in a webserver configuration file, or in the script itself. Check for auto_prepend_file too.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, I figured what was going wrong. I set error_reporting in my code, which was overwriting the php.ini error_reporting.

    Now the reason that that same stuff was working until I upgraded to PHP 5.3.2 was this - in my code, I set the error_reporting command:

    Code:
    error_reporting(6143);
    I should've set it as:
    Code:
    error_reporting(E_ALL ^ E_NOTICE);
    I'm guessing the meaning of 6143 is different in PHP 5.3.2 compared to in 4.1 (or whatever my earlier version was).

    As for the php3 extension, it was to be set in the /etc/httpd/conf.d/php.conf file:
    Code:
    AddHandler php5-script .php .php3
    AddType text/html .php
    Thank you, crmalibu, for your suggestions!

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    69 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure why this is the trend now.. why ints?

    I should expand that... is there a bug in the predefined constants?

  5. #5
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have to use ints when setting in webserver config files, but otherwise, I don't know why some people use ints in other places. Probably just don't know they shouldn't.


Bookmarks

Posting Permissions

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