Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have PHP5 installed on my CentOS 5 server running Apache 2.2.3 (did a yum install)

I ensured the httpd.conf file has all the necessary AddType and LoadModule commands. Even tried restarting httpd.

But when I run a php file, instead of it being executed, the file just downloads. Any ideas what I might be missing?

I did see the different threads returned by Google. Also tried the solutions posted on other similar SF questions (here and here) but didn't find a resolution. Tried a manual install of php as well. But php files just don't get executed.

More on this

Now I can get the php file to show and not get downloaded. From the httpd.conf, removed the AddType directive and added AddHandler.

On further investigation, if I run a command php -f my_php_file.php on my server, the file executes fine. So php installation is not the issue. But somewhere in the configuration file, the mapping is missing (i.e. execute .php files using php). Any ideas?


share|improve this question
Logs, config files... all useful information. – womble Jul 15 '11 at 6:25
no error logs generated wrt the files. Which files should I post the content of? httpd.conf, any others? – lostInTransit Jul 15 '11 at 8:37
up vote 1 down vote accepted

I wild shot in the dark (since you did not tell us the exact yum command(s) you entered):

I guess you installed PHP CGI/CLI version which needs further configuration to actually work, but what you meant to install was Apache mod_php module. Maybe you installed php-cli instead of php?

share|improve this answer
I ran this command - yum install php. This installs both php and the apache php module (doesn't it)? – lostInTransit Jul 15 '11 at 8:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.