Warning: Trying to access array offset on value of type bool in /homepages/28/d1016621825/htdocs/wp-content/themes/tomelliott/single.php on line 12

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /homepages/28/d1016621825/htdocs/wp-content/themes/tomelliott/single.php on line 12

Deprecated: Automatic conversion of false to array is deprecated in /homepages/28/d1016621825/htdocs/wp-content/themes/tomelliott/single.php on line 14

Apache php display friendly server error

26 November, 2011 by Tom Elliott

Recently, I’ve started working on a few PHP projects on a local development machine and have been getting frustrating “500 internal server errors”. The machine is a a windows 7 PC running Apache server, PHP and MySQL.

Any coding bugs are much easier to locate and fix if a meaningful description of the error, along with a line number is displayed instead of the generic 500 page. If you have a similar issue, the solution probably lies within a quick update to the loaded php.ini configuration file. In Notepad, open the php file and locate the line (usually around 530) and change the line display_errors = off to display_errors = on

The php.ini file itself is usually in the php root folder from the install location but you can check the loaded php.ini file by navigating to a php page with the command phpinfo();

It is recommended however to only show friendly error messages during development or on a development machine for security reasons

Remember to restart the apache server for any changes to your php.ini file to take effect!