enabling php in apache

Solution 1:

Quick google search will show tons of options concerning configuration and installation. Give this one a go: http://php.net/manual/en/install.php

The easiest way to test you PHP installation is to run a php_info() function. See details and examples here: http://php.net/manual/en/function.phpinfo.php

Solution 2:

One way to test whether PHP is functioning, is to create a page like this:

<?php
    phpinfo();
?>

You should see a page generated by php with its configuration and settings. If you see the code itself, then Apache is not parsing the PHP and instead just passing it on as a regular text file. Definitely not what you want.

To configure Apache to parse PHP correctly, you need to make sure it is loading the PHP library, and that it is set to serve up *.php files using that library; and finally ensure that you have set up your index pages the way you want, usually so that index.php and index.html are both considered valid default files for a directory on your server.

The specifics of how to do this are explained numerous times in various Apache/PHP setup tutorials, and depending on your operating system and installation specifics, you will need to consult the tutorial or documentation specific to your case. Also you might want to try asking or searching on serverfault.com because the installation and setup of these programs are more suited to that wiki than stackoverflow.com. Once you've got your server running and need some help with specific PHP coding questions, this is the place.

Edit: Removed a line that's not relevant because the question was edited for clarity.