PHP Error type
- Syntax error
- Execution-time error
- Logic error
The generation of exceptions
If XAMPP is installed, the error report can be set in php.ini, and the profile path: C:\xampp\php
You can use Error_reporting (0) To turn off error prompts and report all errors using error_reporting (E_all)
use in INI file; semicolon Comment
Error log
Logging error report logs using the specified file
After the product is put into use, all of the error prompts are usually turned off, as these hints can affect the consumer's experience with the product, and exposing too much information is vulnerable to hacking.
The error message can be saved to a separate text (log file) instead of appearing in the browser.
The default is configured so that you can use Error_log ($msg) to customize the error message in your program
error.php
<?phpecho "Ssdsds"; Error_log ("This is a custom error log message"); >
Open File
[06-aug-2018 07:24:24 Europe/berlin] This is a custom error log message [06-aug-2018 07:24:50 Europe/berlin] This is a custom error log message
Open the php.ini configuration file
Report all errors in PHP
Set PHP error log address:
Log information logged to the operating system log
Common methods
- Openlog ($msg, $option, $facility) open log connections, such as Openlog ("PHP", Log_pid,log_user)
- Syslog ($priority, $msg) generates log messages, such as Syslog (log_warning, "Send custom information to syslog ... ")
- Closelog () Close log connection
syslog.php
<?phpopenlog ("PHP5", Log_pid,log_user); Syslog (log_warning, "Sending custom information to Syslog"); Closelog (); >
The custom information is recorded in the system log, you can click on the warning, which is the generated information, in the Computer Management Event Viewer Windows log application.
PHP Learning 5--Exception Handling