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
- Archived post summaries – June 2011
- Prevent Skype hogging port 80 – June 2011
- Watch out for PHP shorthand – November 2010
- Perl basics for beginners (on Windows) – August 2010
- Gotchas with running a Perl script as a cron job – August 2010