faqts : Computers : Programming : Languages : PHP : Installation and Setup : INI File

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

24 of 32 people (75%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I control error handling in PHP?
Can I log all PHP errors to a file?

Feb 25th, 2002 22:50
Philip Olson, Nathan Wallace,


There are a few manual entries you should read:
  Error Handling and Logging Functions:
    http://www.php.net/manual/en/ref.errorfunc.php
  Error Handling:
    http://www.php.net/manual/en/features.error-handling.php
  error_reporting directive:
    http://www.php.net/manual/en/configuration.php#ini.error-reporting
  error_reporting function:
    http://www.php.net/error_reporting
  Types of errors:
    http://www.php.net/manual/en/phpdevel-errors.php
Now if you're interested in logging php errors to a file, open up your
configuration file (php.ini) and look for the section that's
appropriatly named "Error Handling and Logging".  Something similiar to
the following will exist (shortened for this faqt):
  error_reporting = E_ALL   ; It's good to show ALL errors
                            ; during development
  display_errors = On       ; Print out errors (as a part of the output)
                            ; Turn this off on a production site, on
                            ; during development.
  log_errors  = On          ; Log errors into a log file
  track_errors = Off        ; Store the last error/warning message in
                            ; $php_errormsg (boolean)
  error_log = /logs/php.log ; log errors to specified file
  ;error_log = syslog       ; log errors to syslog (Event Log on NT,
                            ;  not valid in Windows 95)
There are more comments within php.ini.