PHP Troubleshooting Tips

PHP is a versatile server side scripting language that powers many of the world’s websites. Sometimes, however, things can go wrong. The following are tips to help you troubleshoot your PHP installation.

Scripts do not execute – If you load a PHP page and see the contents of the file rather than the proper scripting output, you might need to make sure the PHP module is enabled on your web server. You should also check to make sure “.php” is defined in your Apache configuration file.

For example, to enable a module on a Debian, run:

# a2enmod php
# a2enmod php5

The proper configuration file setting for php mime types would be:

<IfModule mime_module>
AddType text/html .php .phps


Internal Server Error – In pretty much all cases, an internal server error is a server-side problem, not something caused by the user’s web browser. It could be related to permissions. Make sure the PHP files you are running (and any associated files) have the proper permissions that allow your web server to execute them.

It could also be another server-side problem. If you have php-cli installed, you can run PHP from the command line to view any errors. Then, from the command line, simply run:

$ php your-cold.php

If there is an error in execution, you will likely see it in the output. If there is not an error, it will simply display the HTML output.

Come back soon for more helpful server troubleshooting tips.