A fresh mix of code snippets and tutorials

Disable PHP version info & error messages

Whenever possible, prevent access to sensitive information about your server. Here is how to prevent PHP from displaying errors and their sensitive infos.

Disable PHP errors

To disable PHP errors, add the following line to your server’s php.ini file:

display_errors = Off

That will ensure that errors aren’t displayed to the public. Leave it on during development, then switch it off for production (when your site goes live).

Disable PHP version information

In similar fashion, this directive should be added to your php.ini file to disable the broadcasting of your PHP version infos:

expose_php = Off

If you don’t have access to your server’s php.ini file, contact your host for help.

★ Pro Tip: