Instphpwin
Instphpwin
1 On Windows
1. The PHP setup file is a zip archive. Extract the contents of the zip file
using Winzip or any other archiving tool
2. In the extraction process, all the zipped files will be extracted into a
folder, whose name is based on the version of PHP that was
downloaded. For example, if php-5.1.0RC1-Win32.zip was
downloaded and extracted to C:\, there will be a folder called C:\php-
5.1.0RC1-Win32\ where the files extracted can be found
3. Rename the folder php-5.1.0RC1-Win32 to php (Refer to diagram
1.1)
d. Select the Path variable under System variables section and click
Edit. This pops up a window, in the text box Variable value add
;C:\php at the end of the path as shown in diagram 1.5
Apache does not know that PHP is just installed. Therefore Apache needs
to be informed about PHP especially where to find it.
This is done via Apache's httpd.conf file. Apache reads this file and
understands what modules need to be loaded and where these modules
are located.
Edit Apache's httpd.conf file. Make sure the PHP mime type is specified
and uncommented. The line should look like this: (Refer to diagram 1.6)
AddType application/x-httpd-php .php
This line means that every file that ends with .php will be processed as a
PHP file.
If need arises to support other file types, like .php3, .html, .asp
and .phtml, simply add them to the list, like this:
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .html
AddType application/x-httpd-php .asp
Ensure that the PHP module is loaded by adding the following line in the
httpd.conf file
LoadModule php5_module "c:/php/php5apache2.dll"
This line tells Apache from where to load the .dll file in case of Windows
or the .so file in case of Linux which is required to execute PHP. This line
enables loading the PHP module dynamically into Apache. Usually in Linux
the PHP source installer automatically inserts this line. If this line does not
exist then insert it manually in the httpd.conf file.
To test whether PHP has been successfully setup and integrated with
Apache2 create a simple script named phpinfo.php that contains the
following code: (Refer to diagram 1.8)
<?php
phpinfo();
?>