First say PHP error message from PHP100 Forum
The error message for PHP consists of a few parts
{Error type}: {error reason} in {Error file} on {error row}
Describes which file in which line the error occurred for what reason.
Common types of errors are generally the following:
Parse error (parsing errors) is generally accompanied by a syntax errors (syntax error), stating that your program does not conform to the PHP syntax.
It is the highest-level error and the entire script is not executed at all.
Are generally caused by an expression that lacks a ";" or a variety of parentheses. Look at the detailed information to see where the problem lies.
General syntax errors will give you a parser code to tell you where the problem is. Like what:
Parse error:syntax error, unexpected t_string in xxx.php on line 9
T_string is a parser code, as the name suggests, it represents a string, many error reasons will be with the parser code. Through it you can learn more directly about the cause of the error.
Unexpected meaning is not expected, in other words is superfluous.
More parser codes Please refer to: http://www.php.net/manual/zh/tokens.php or PHP Manual in the English version of the name: List of Parser tokens Chinese version called: Parser code List
The above error means that your line Nineth has an unexpected string.
My Code:
1-7: Slightly
8:test (Array (' a '))
9:xxx ();
: >
How can this problem be solved? Delete the nineth line of XXX, it does conform to the PHP syntax.
But that's not what I want, actually my 8th line is missing a ";" solution is to add a semicolon at the end of line 8th.
Note: This example also illustrates a problem where the error report says which row, the problem is not necessarily the line, it may be the previous line or lines of it caused. The most typical example is the number of error lines in a program tip in the last line of the file, you see, found that the line in addition to ">" No other characters, this situation is generally missing quotes caused. You're going to look in front of a pair of quotes or some other punctuation. If you have to, and look for the line number does not let go, that is not the problem of PHP.
Fatal error (fatal error), second only to the error of the parsing error, the script terminates when it executes to the row where the error occurred.
On the basis that the program conforms to PHP syntax, uses undefined function, or require a nonexistent file, the dead loop causes the program execution timeout, can cause fatal error.
The general performance is:
Fatal error:call to undefined function func () into php100.php on line So-and-so
That is, in a certain line you call an undefined func function, this time it is generally to see if you have forgotten to include the included file, whether the wrong function name, whether the file name is incorrectly written. (php100.com)
Warning (warning) is slightly lower than the fatal error level, but the program will not terminate because of a script error.
Usually appears in include a nonexistent file, or a program requires a parameter, but you do not pass the parameters, and you do not specify the default value of the parameter.
Warning as the situation can be avoided, it is impossible to avoid, can add @ force shielding.
Notice (notification), the lowest level, generally can be ignored, will not affect the operation of the script. Most occurrences occur when a variable or an array is not defined.
Note: Most notice can be ignored, but a few notice may also reflect a more serious problem.
Like notice:undefined Variable:sql in xxx.php, line xx
You see a variable "sql" Undefined, this can be very dangerous, in the case of Register_globals=on, this error can directly become someone else to manipulate the database back door.
In addition, there are some other types of errors, usually not common, I will not say more.
Summarize
To sum up, PHP error tips will tell us a lot of things, for us to find errors to provide a great convenience. Make good use of it, will greatly improve our working efficiency and quality of work.
However, while it brings benefits, it may also disclose sensitive information about the server, allowing attackers to discover vulnerabilities in the server.
PHP development environment must open all error prompts, turn on error display. Minimize the occurrence of accidents.
The production environment must be turned off incorrectly, using logs to record errors instead. Don't give an opportunity to the conscientious.