Friday, September 24, 2010

Install Apache and PHP on Window XP

Apache: 2.2.16

PHP: 5.2.14

Mysql: 5.1.50


1) Download and unpack
I used httpd-2.2.16-win32-x86-openssl-0.9.8o.msi

2) Install
When you install Apache, you'll get a prompt for "Server Information." Here is the settings I used:
Network Domain: localhost
Server Name: localhost
Admin Email: (any email. real or fake)

[checked]: for All Users, on Port 80, as a Service

3) Starting/Stop Apache
After installing, Apache2 automatically starts. The GREEN icon in the System Tray means it started. The RED icon means the "Monitor Apache Servers" is running, but Apache2 isn't started.

You can easily start/stop/restart Apache and Apache2 via that icon in your System Tray. If you get "The requested operation has failed!" error while starting apache use the "Test Configuration" shortcut in the Start Menu to find the error (if the text window pops up then closes before you can read it, your config file is fine).

4) Testing
Now the ultimate test. To see if it's serving. Open your browser and head to: or http://localhost/
If it shows the It works! you have your server software installed and running.

5) Configuration:
Making Apache point to your files, using Notepad open C:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf (in the start-menu there should also be a "Apache HTTP Server 2.2 > Configure Apache Server > Edit the Apache httpd.conf Configuration File" shortcut) and search for DocumentRoot.

Change it from something like

DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
DocumentRoot "C:/public_html"

it will locate where your HTML files and site are located, then scroll down about one page and change

Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs" >
Directory "C:/public_html >


1) Download and unzip
I select to install PHP manually,

Unzip the file to C:\php

2) Configuration
Rename C:\php\php.ini-dist to php.ini and edit php.ini file for parameters:

doc_root = "C:\public_html"
extension_dir = "C:\php\ext"

Edit Apache Conf File in
C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd

add following at the begin of apache configuration file
LoadModule php5_module "C:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
PHPIniDir "C:/php"

Then Reboot Microsoft Windows system(very important)

3) Testing
Restart Apache if it is already running (if it doesn't start or you get errors, use your Apache "Test Configuration" shortcut in the Start Menu to see why).

To test your PHP simply create a test.php file in your Apache "DocumentRoot" folder (C:\public_html\ in my case). In your test.php file, type these 3 lines and then load the file in your browser like http://localhost/test.php (you should get a whole long list of php variables, settings, etc):

1) Download and installation for mysql-essential-5.1.50-win32
Install path is in
C:\Program Files\Mysql\mysql server5.1\

log files, databases is installed in

start mysql using
C:\Program Files\Mysql\mysql server5.1\bin\mysqld --console

stop mysql using
C:\Program Files\Mysql\mysql server5.1\bin\mysqladmin -u root shutdown

2) Mysql server instance configuration wizard and keep use default

Hint: if you reinstall Mysql, you have to delete mysql data 1) C:\public_html\mysql_data; 2) Ran RegEdit, searched for every instance of MySQL, and deleted it from the registry.

then install again

No comments: