CHAPTER 8 How to Fix The Web: Obscure Back-End Techniques and Terminal Secrets
or warnings and notices as well. All of these can be set in a configuration
file, in .htaccess or within the PHP script itself.
You can find out your current settings by running the PHP function
phpinfo. Create a PHP file which calls the function and visit it in your
browser:
$ echo "<?php phpinfo()?>" > /var/www/vhosts/smashingmagazine.com/htt-
pdocs/phpinfo.php
The two columns show the website and server-wide settings. This
shows that display_errors is off, which is good, because it should be
off on live websites. It means that no PHP errors will ever be seen by the
casual visitor. log_errors on the other hand should be on. It is very handy
for debugging PHP issues.
The error_reporting value is 30719. This number represents bit
flags or bit fields. This is a technique for storing multiple yes/no values
in a single number. In PHP there are a series of constants representing
different types of errors.^18 For example, the constant E_ERROR is for fatal
errors and has the value 1; E_WARNING is for warnings and equals 2; E_PARSE
18 “Predefined Constants”, PHP.net. http://smashed.by/errorfunc
phpinfo function showing configuration settings.