Red Hat Bugzilla – Bug 219070
apache won't parse php code
Last modified: 2007-11-30 17:11:51 EST
Description of problem:
By default, apache won't parse PHP code.
Version-Release number of selected component (if applicable):
Very reproducible. Just install a LAMP server and this problem will show up
sooner or later.
Steps to Reproduce:
1. Install Apache, mySQL and PHP
2. Copy something written in PHP to the webroot (/var/wwwroot by default,
/home/wwwroot in my case)
3. Set permissions to apache,apache for all files and folders. Set "executable"
to ON for all .php files.
4. Type path to .php into browser
The browser will display the php source code
Browser should execute the code, producing a nicely formatted web page
To fix this problem, add the following line to /etc/httpd/conf/httpd.conf :
AddType application/x-httpd-php .php
and maybe change the line starting with "DirectoryIndex" to the following:
DirectoryIndex index.php index.php4 index.php3 index.cgi index.pl index.html
index.htm index.shtml index.phtml
This looks like a configuration/support issue; this certainly does work out of
the box. Please trying mailing email@example.com for further help.
Shouldn't the "application/x-httpd-php .php" handler be enabled by default? Why
purposely disable it? Or are you saying that it would work on a clean Fedora
Yes, it works on a clean Fedora install - see /etc/httpd/conf.d/php.conf:
AddHandler php5-script .php
AddType text/html .php