0

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?

Thanks.

lostInTransit
  • 149
  • 1
  • 7

1 Answers1

1

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?

Janne Pikkarainen
  • 31,852
  • 4
  • 58
  • 81