Surjya Narayana Padhi Surjya Narayana Padhi - 1 month ago 4
PHP Question

Installing PHP, MySql and Apache on windows

Its my first time working with Apache,PHP,MySql. I downloaded and installed the latest package of these 3. Now I checked with apache and the index.html works. Now I replaced the index.html with some php script to check if my php works or not. When opened the html page again I see the php code directly. It seems it does not work. following is how my php code looks like.

<html>
<body>

<?php
echo "Hello World";
?>

</body>
</html>


when I open my index.php , I see the above code itself. Can anybody let me know whats wrong and how can i fix it?

Answer

Check your apache httpd.conf file for some commented out code that looks like this

LoadModule php5_module libexec/apache2/libphp5.so

and further down the file, this...

<IfModule php5_module>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    <IfModule dir_module>
            DirectoryIndex index.html index.php
    </IfModule>
</IfModule>