On my WordPress blog, whenever I have a PHP error, it breaks the site and displays a white page with the PHP error.
For example:
Parse error: syntax error, unexpected ‘;’ in…
I can fix the error. However, I don’t want users to see a broken site while I do. Is there a setting I can enable that will suppress the error (or more gracefully handle it) and continue to parse the rest of the PHP?
When you have a syntax error in a PHP page, it will always immediately stop parsing. It’s the same thing as a compile error in languages such as C#, VB etc. There is no getting around this.
There are two ways you can suppress this error message. The first is with the
error_reportingdirective in yourphp.inifile. It’s likely set toE_ALL & ~E_DEPRECATED. You can fine tune what is reported (via error logging and out to the display) by configuring the directives located on the PHP Site.The other (simpler) way to suppress these is via the
display_errorsdirective in yourphp.inifile. Simply set this toOffand restart your web server and you won’t see these errors any longer – just a white page.