Wednesday, April 6, 2011

Installing PHP


Installing PHP on Windows XP from the downloaded PHP zip file is just a matter of extracting the zip file to a directory and altering the Apache configuration file to use the PHP interpreter for PHP scripts.

To download PHP, go to http://www.php.net/downloads.php and choose the PHP ZIP package listed under the "Windows Binaries" heading.
This will take you to a page listing various mirrors containing the file. You can choose any mirror listed on the page but you may get faster downloads from the more local file mirrors (the ones at the top of the list).

Right click on the PHP zip archive and click "Extract All..." and then "Next".
Change C:\Downloads\php-4.3.3-Win32 to C:\ and click "Next", followed by "Finish".
There should now exist a folder C:\php-4.3.3-Win32 .
Rename the this folder from C:\php-4.3.3-Win32 to C:\php.

Open the httpd.conf (C:\Program Files\Apache Group\Apache\conf\httpd.conf) file and find the line:



Immediately under this line insert the following lines:

ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php .phtml
Action application/x-httpd-php "/php/php.exe"

Save the file as httpd.conf.

To test that PHP and Apache now work together, create a plain text file and insert the following:



Save this file as test.php in the C:\Program Files\Apache Group\Apache\htdocs folder.
Restart the Apache server (Start > Programs > Apache HTTP Server > Control Apache Server > Restart) so Apache will use the altered configuration file.
If you go to http://127.0.0.1/test.php in a web browser you should see a page like this:



No comments:

Post a Comment

Dear Reader, if you like My Blog content, feel free to comment on our blog posts.