How to install PHP on Windows XP? Step-by-step guide
PHP gained popularity over the years. Because of its simplicity, cross-platform, open source, free availability it is now the leading server application platform available today. PHP is available in many flavors. People feel PHP installation is complicated and tough. That is a wrong opinion. PHP is fun to learn and powerful enough to build enterprise web solutions. PHP combined with MySql is an excellent platform for web applications. How to install PHP on Windows XP computer? How to setup MySQL database server on Windows XP? Which web server is best? IIS or Apache? The questions are endless. For a PHP beginner i will guide teach the each way to setup PHP.
What do i need to have?
This installation guide is to install PHP and MySQL on Windows XP Professional computer with IIS (Internet Information Server) as webserver. So you need PHP version 5.0. You can download the latest PHP version from http://php.net/downloads.php . Warning: Don't download Installer. Only download ZIP file. You need MySQL Server. MySql community server is available for free. The installation is simple and straight forward. What else? The IIS server is bundled with Windows XP CD.
The Installation
IIS
First Install the IIS server. To do this go to control panel -> Add/Remove Programs in your windows XP Computer. Click Add Remove Windows Components button. Windows components Wizard Dialog box will open. Tick the checkbox prior to Internet Information Services. It will take approximately 13 MB of your disk space. Click next. You will be prompted to insert your Windows XP CD-ROM. Insert it. Click Next. Thats it. By Default IIS folders are located at c:\inetpub\wwwroot. make a note of it
PHP
Now extract the zip file you have downloaded to C: drive or D:\ drive or whatever drive you wish. Rename the folder something like php5. So the path should be c:\php5 or d:\php5. Open the folder. Find the file named "php.ini-development" and rename it to "php.ini". Open this file in notepad and make the following changes.
Find ;doc_root = and change it to doc_root="c:\inetpub\wwwroot"
Find ;extension=php_mysql.dll and change it to extension=php_mysql.dll (just remove ;)
Find ;cgi.force_redirect = 1 and change it to cgi.force_redirect = 0. This is must
Now save the file and close.
Next right click my computer icon on the desktop and click properties. The System properties Dialog box will appear.
Click Environment variables. In the System Variable find a variable named path and select it. Click Edit. You will be prompted for Variable Name and Variable Value. In Variable Value Text box go the end of the line. append c:\php5. Click ok. Click ok. This sets the path Environment variable for php. You don't have to put php.ini file in Windows System Directory. PHP can now find the ini file using the path variable.
Install MySql
Installation of MySql Database server is simple and straight forward. Just double click the MySql Installer and it will do the rest. Don't select advanced setup. In the end you will be asked for MySql root password. Give a password that you can remember.
Configure IIS
There are two ways to setup php on IIS. One is CGI executable and other is ISAPI server module. We will opt for CGI. We have configure the php.ini file for CGI. Go to control panel -> Administrative Tools -> Internet Information Services. Open Default website node. Put your php script directory in c:\inetpub\wwwroot. For example c:\inetpub\wwwroot\testphp. Don't keep the directory anywhere else. IIS 5 will throw exception. The browser will give file not found exception. In the default websites your folder is shown as virtual directory. Right click it and open properties.
Under Directory Tab click create. IIS Will assign Default Application Name, Set Execute permission to Scripts only. Click Configuration. The application configuration dialogbox will appear.
Under Mapping Click Add. Click Browse. Go to your php5 directory. Select php-cgi.exe click open. In the extension give .php. Click ok Apply ok.
Now test your php installation. Open a Notepad type the follwing,
Hello World
'; ?> Save as test.php Save AS Type: All Files. Save the file at location c:\inetpub\wwwroot\testphp\Now open your web browser Internet Explorer or Mozilla firefox. In the address bar type http://localhost/testphp/test.php and press enter. Php will output the Hello world.
That is the simple installation procedure of php 5 on windows XP and IIS.
No comments:
Post a Comment