Prerequisites
Web server
Versions used
Apache HTTP server 2.2.8
Steps
- Download the zip package from PHP website, http://www.php.net/downloads.php. The installer package as at version 5.2.6 doesn't seem to install correctly on Vista.
- Create a folder C:\PHP
- Unzip the contents of the zip package to this folder.
- Add C:\php to the path system variable by going to Start → Settings → Control panel → System → Advanced System Settings → Advanced tab → Environment variables
- Restart the computer
- Make a copy of the file php.ini-recommended in C:\PHP and rename the copy as php.ini
- Update the doc_root directive in php.ini file to the DocumentRoot path set in the Apache httpd.conf file e.g. doc_root = C:\Apache\htdocs
- Update the extension_dir directive in php.ini file to extension_dir = C:\PHP\ext
- Update the display_errors directive in php.ini file to display_errors = on
- Update the date.timezone directive in php.ini e.g. date.timezone = Africa/Nairobi
- Update the Apache httpd.conf file by adding the following lines
LoadModule php5_module "C:/php/php5apache2_2.dll" AddType application/x-httpd-php .php PHPIniDir "C:/php"
- Add index.php to the DirectoryIndex setting of the httpd.conf file i.e. DirectoryIndex index.html index.php
- Restart Apache by going to Start → Programs → Apache HTTP Server 2.2 → Control Apache Server → Restart
- Create a text file named test.php in the Apache document root path. Add the following to the file. <?php phpinfo(); ?>
- Open your browser and navigate to http://localhost/test.php. If a page with PHP configuration information is displayed, the PHP installation and configuration was successful.
No comments:
Post a Comment