PHP files return a blank page

November 7th, 2007

If, when you browse to a PHP page, you just see the text of the PHP script, it means the server knows nothing about PHP. To it the PHP script is just a text file, so it sends you that, like it would a .txt file.

If, however, you get a blank page, it suggests the Web server knows that .php files should be served up like Web pages, but the PHP isn't being handled properly.

On Apache, the most likely cause - or at least the first thing you should check out - is that the httpd.conf file hasn't been updated properly to point to the PHP module. Make sure this file contains LoadModule, AddType and PHPIniDir statements such as the following (these are for an XAMPP installation of Apache/PHP on Windows):

LoadModule php5_module "c:/xampp/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "c:/xampp/php"

If these lines are in the httpd.conf file, the problem may just be that the file hasn't been read since the change was made. Restart Apache and the changes in the file will be applied.

Potentially similar posts

Leave a comment