Category Archives: PHP

Apache downloading the PHP page instead of executing

Faced a weird problem after installing Apache 2 and PHP 5 on my Ubunto 10 machine today. The browser was giving an option to download the page whenever I tried clicking a PHP page link. Clearly the PHP was not getting executed properly by Apache and it was treating it as an unknown file format.

After a couple of hrs figured out this solution.

In httpd.conf file, add following lines

<IfModule mod_php5.c>
  AddType application/x-httpd-php .php .phtml .php3
  AddType application/x-httpd-php-source .phps
</IfModule>