In-depth explanation: socket Communication in php
1. Common Errors in php
1. Syntax Error
* 1). Write less semicolons
* 2 ).. .....
2. Environment Error
* 1). php configuration waiting
3. logical error
* 1) to use an equal sign, two equal signs are used in the result.
2. defined error types
Error name |
Error description |
E_ALL |
All errors and reports |
E_ERROR |
Fatal runtime error. Script Execution is |
E_WARBING |
Run-Time Warning (non-fatal), script execution will not be paused |
E_PARSE |
Parsing error during compilation |
E_NOTICE |
Runtime reminder |
E_STRICT |
Start php's code modification suggestions to ensure the best code interoperability and forward compatibility |
E_DEPRECATED |
Runtime notification. After startup, a warning will be given to code that may not work properly in future versions. |
E_CORE_ERROR |
Fatal error occurred during php startup Initialization |
E_CORE_WARNING |
Warning error (non-fatal) during php startup Initialization) |
E_COMPILE_ERROR |
Fatal errors during compilation |
E_COMILE_WARNING |
Compile-time warning (non-fatal error) |
E_USER_ERROR |
Error message generated by the user |
E_USER_WARNING |
User-generated warning message |
E_USER_NOTICE |
User-generated reminder message |
E_USER_DEPRECATED |
User-generated warning information, similar to E_DEPRECATED,trigger_error Function generation |
E_RECOVERABLE_ERROR |
A captured error indicates that a very dangerous error may occur, but the PHP engine is not unstable yet. If the error is not captured by the custom handle (seeset_error_handler() ), And the script stops running. |
3. error levels in php
1.Deprecated (not recommended | outdated)
Error
* 1 ).Lowest-level errors
For exampleereg
Function, mysql_escape_string
* 2 ).Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead.
2.Notice
Notification-Level Error
* 1). Access undefined Variables
* 2) when accessing the array, $ arr ["name"]; The program first queries the constant name. If not found, the program treats the name as a string.
3.Warning
Warning-Level Error
* 1) the number of parameters is incorrect.
* 2) the parameter type is incorrect.
4.Fatal error
Fatal errors(Terminate the program to continue execution)
* 1). Call undefined Functions
* 2) the parameter type is incorrect.
5.parse error
Syntax Parsing Error
* 1). The check phase fails, and no other errors will be seen, because it is not yet there,The program has not been resolved successfully.
6.E_USER _ related errors
* 1). The check phase fails, and no other errors will be seen, because it is not yet there,The program has not been resolved successfully.
4. Error-related options in the php configuration file
Option |
Description |
Error_reporting |
Set the error report level |
Display_error |
Show error? |
Log_errors |
Set whether to record the generated error information to the log or error_log |
Error_log |
Set an error log storage file |
Log_errors_max_len |
Set the maximum number of log_errors bytes |
Ignore_repeated_errors |
Ignore duplicate error messages? |
Ignore_repeated_source |
Ignore duplicate message sources |
Track_errors |
If this option is enabled, the last error will always be saved in$php_errormsg Medium |
5. How to set the error level
1. Modify the error_reporting value in the configuration file.
2. PassError_reporting Function
Set
* 1. error_reporting (0); no error is displayed, except for E_PARSE
* 2. error_reporting (-1) | error_reporting (E_ALL) show all errors
3. Use ini_set ('error _ report', 0) to set
6. Suppress error output symbols
@
1.@
Settype ()
7. PHP errors returned by trigger_error
The function of triggering an error is not only limited to the php parser, but also
trigger_error()
Function trigger error. Trigger_error ('error information', custom error, for example: (E_USER_NOTICE) trigger_error ('custom error information', E_USER_NOTICE); this function does not interrupt the program to continue execution.