Apache shows php code instead of executing

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. I am using apache2, php5 and windows vista. I have been searching all over the internet without success and am almost banging my head against the wall. Can anyone save me from a concussion?

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"

Answer

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.

Leave a Reply

Your email address will not be published. Required fields are marked *