LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Huge amount of "PHP Notice:" -> huge logs (https://www.linuxquestions.org/questions/linux-software-2/huge-amount-of-php-notice-huge-logs-628890/)

Braynid 03-18-2008 05:23 AM

Huge amount of "PHP Notice:" -> huge logs
 
Hey,

For some while now I've been having this problem with a site we host. In the 'error_log' for the site I've fount MANY (as in several GB logs) PHP notices that look something like:

Code:

[Tue Mar 18 11:58:25 2008] [error] [client some.ip.here] PHP Notice:  Undefined index:  check_3 in /var/www/vhosts/mydomain/httpdocs/somefile.php on line 150, referer: http://referer/url
there are also other notices, like:

Code:

PHP Notice:  Undefined variable:
PHP Notice:  Use of undefined constant REQUEST_URI - assumed 'REQUEST_URI' in
PHP Notice:  Use of undefined constant ppp - assumed 'ppp' in

The code works fine and I don't understand why it gives this notices. Is there any way to silence PHP and don't show this errors? The problem is that they created around 8GB of logs in just a week.

Thanks.

acid_kewpie 03-18-2008 05:51 AM

change the error_reporting option in your php.ini file to not invlude E_NOTICE
Code:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; error_reporting is a bit-field.  Or each number up to get desired error
; reporting level
; E_ALL            - All errors and warnings (doesn't include E_STRICT)
; E_ERROR          - fatal run-time errors
; E_WARNING        - run-time warnings (non-fatal errors)
; E_PARSE          - compile-time parse errors
; E_NOTICE          - run-time notices (these are warnings which often result
;                    from a bug in your code, but it's possible that it was
;                    intentional (e.g., using an uninitialized variable and
;                    relying on the fact it's automatically initialized to an
;                    empty string)
; E_STRICT          - run-time notices, enable to have PHP suggest changes
;                    to your code which will ensure the best interoperability
;                    and forward compatibility of your code
; E_CORE_ERROR      - fatal errors that occur during PHP's initial startup
; E_CORE_WARNING    - warnings (non-fatal errors) that occur during PHP's
;                    initial startup
; E_COMPILE_ERROR  - fatal compile-time errors
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
; E_USER_ERROR      - user-generated error message
; E_USER_WARNING    - user-generated warning message
; E_USER_NOTICE    - user-generated notice message
;
; Examples:
;
;  - Show all errors, except for notices and coding standards warnings
;
;error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
;
;  - Show all errors, except for notices
;
;error_reporting = E_ALL & ~E_NOTICE
;
;  - Show only errors
;
;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
;
;  - Show all errors
;
error_reporting  =  E_ALL


Braynid 03-18-2008 06:30 AM

Thanks, that stopped the logs from getting bigger. But can you please tell me what was generating them, so I know what to look for?!

Thanks.

acid_kewpie 03-18-2008 06:32 AM

looking at the examples, bad coding. ;-)

Braynid 03-18-2008 06:35 AM

Is there a possibility that such notices are generated when PHP is looking in GET for elements that aren't there?

Anyway the log problem is solved, thanks acid_kewpie!


All times are GMT -5. The time now is 11:12 PM.