Apache shows PHP code instead of executing it

apache, php

Solution

You must enable php! Check the folder `mods-enabled` in the Apache directory (default: `/etc/apache2/`) to see if you find a file named `php`. I don't remember the extension but I think it's `.so`.

Also check in `/var/log/apache2/error.log` to see if you have any other errors.

Problem

I have recently been trying to install PHP and Apache on my computer. After many hours, they're installed. I have modified the httpd.conf and php.ini files like everyone says. I then created a simple PHP script: ``` <?php phpinfo(); ?> ``` But when I try to run it with `http://127.0.0.1/phpinfo.php` it just shows the source code instead of executing it. I am using Apache 2, PHP 5 and Windows Vista. EDITED LINES: PHP.INI: ``` short_open_tag = On ``` HTTPD.CONF ``` LoadModule php5_module "C:/php/php5apache2_2.dll" AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps PHPIniDir "C:/php" ```

Original source

Related problems