To be able to ‘interpret’ any PHP files, we must install PHP application in our server.
Get the PHP packet on http://www.php.net/downloads.php
1. First, extract the PHP package ( php-5.2.8-Win32.zip ). In my case, I prefer to extract the package inside the directory where Apache server was installed ( E:\webserver\php528). Or to make easy you can extract them in C:\php (create this directory first).
2. Rename “php.ini-recommended” in our PHP folder to new file name “php.ini”
3. Modify this “php.ini” file:
a. Turn On the tag ‘short_open_tag’ so any script started with “<?” (not just “<?php” will be recognized as PHP scripts.
short_open_tag = On
b. Turn On the tag ‘magic_quotes_gpc’ so if your visitors enter an inverted comma (single quote) into your web form, the script will receive that unadorned inverted comma (single quote).
magic_quotes_gpc = On
c.Turn On the tag ‘display_errors’
display_errors = On
4. Now, on the other side, we need to let Apache (server) know that we have install PHP and where to can find it –> Configure Apache (‘httpd.conf’) about PHP
Open the Apache configuration file again:
“httpd.conf” (in folder /conf/)
a. add lines telling Apache where can find model ‘php5apache2_2.dll’
LoadModule php5_module “c:/php/php5apache2_2.dll”
b. Search for “AddType” in the file, and add the following line after the last “AddType” statement. Do this no matter which version of Apache you are using. For Apache 2.2.x, you can find the “AddType” lines in the <IfModule mime_module> section. Add the line just before the closing </IfModule> for that section.
AddType application/x-httpd-php .php
c. Finally, for those using one of the Apache 2 versions, you will need to indicate the location of your PHP ini file. Add the following line to the end of your httpd.conf file.
Now restart Apache for the changes to take effect .
To check whether the configuration Apache – PHP is okay, let’s create a new file, names “test.php” (warning: with the quotes, or the software will add a “.txt” extension behind your back). and put it in our document root directory . The content of this file is shown below.
phpinfo() is the infamous PHP function which will spit out all kinds of stuff about PHP and your server configuration.
Type http://localhost/test.php on your browser’s address bar and if everything works well you should see something like this .