Troubleshooting of PHP errors: Difference between revisions

Jump to navigation Jump to search
Line 188: Line 188:


== troubleshooting steps of function ==
== troubleshooting steps of function ==
Check the error logs
Display error message or check the PHP error logs
* [http://php.net/manual/en/function.error-reporting.php PHP: error_reporting - Manual]
* {{kbd | key=<nowiki>ini_set("display_errors", "On");</nowiki>}} See details on [http://php.net/manual/en/errorfunc.configuration.php PHP: Runtime Configuration - Manual]
* {{kbd | key=<nowiki>error_reporting(E_ALL);</nowiki>}} See details on [http://php.net/manual/en/function.error-reporting.php PHP: error_reporting - Manual]
* [https://www.jetbrains.com/help/phpstorm/event-log-tool-window.html Event Log - Help | PhpStorm]  
* [https://www.jetbrains.com/help/phpstorm/event-log-tool-window.html Event Log - Help | PhpStorm]  
Check the Web service logs
# {{kbd | key=<nowiki>sudo tail /var/log/httpd/error.log</nowiki>}} if the web service logs was located at {{kbd | key=<nowiki>/var/log/httpd/error.log</nowiki>}}
# Example log: {{kbd | key=<nowiki>[Thu Nov 08 12:20:40.412630 2018] [:error] [pid 12769] [client x.x.x.x:4433] PHP Parse error:  syntax error, unexpected '$var' (T_VARIABLE) in /home/wwwroot/path/to/file.php on line 100</nowiki>}}
# Display partial source code: {{kbd | key=<nowiki>sed -n '990,110p;111q' /home/wwwroot/path/to/file.php</nowiki>}}<ref>[https://stackoverflow.com/questions/83329/how-can-i-extract-a-predetermined-range-of-lines-from-a-text-file-on-unix How can I extract a predetermined range of lines from a text file on Unix? - Stack Overflow]</ref>


Simply the question
Simply the question

Navigation menu