Wednesday 18 June 2008

How to Install WampSever (PHP,Apache,MySQL on Windows XP SP3)

Download and install from
http://www.wampserver.com/en/download.php

PROBLEMS ENCOUNTERED AFTER INSTALLATION

When I try to start the Apache service, a window pops up and says:
-------------------------------------------

Your port 80 is actually used by:

Server: Microsoft-IIS/5.1

Cannot install the Apache service, please stop this application and try again.

Press Enter to exit...
------------------------------

SOLUTION:
Uninstall Internet Information Services (IIS)
How to:
Start>>Control Panel>>Add and Remove programs>>Add/Remove Windows components>>
Windows Component Wizard opens, Scroll down to Internet Information Services (IIS) and make sure it is Unchecked. If it isn't uncheck and follow the uninstallation process.
NOTE: YOU WILL NEED YOUR WINDOWS XP INSTALLATION CD TO COMPLETE THIS TASK.
After completing this successfully, restart your computer and start APACHE SERVICE.

PROBLEM:
#2003 - Can't connect to MySQL server on 'localhost' (xxxxx)

SOLUTION:

Check what colour your wamp icon is... yellow+white or all white?

If it is yellow+white move further down this post

----------------------------------------------------------------------------------------------
WHITE WAMP ICON
----------------------------------------------------------------------------------------------
If your wamp icon is white then mysql service is running but phpmyadmin cannot connect because its paramaters are inncorrect.

first find out what port your mysql is running on....

goto C:\wamp\bin\mysql\mysql5.0.51a and open the configuration file 'my' or 'my.ini'
it is written 3 times in this file

----------------
[client]

port=3306
----------------
# The TCP/IP Port the MySQL Server will listen on
port=3306
----------------
[mysqld]
port=3306
----------------


3306 is the standard port for mysql. if yours is different keep a note of it and

goto C:\wamp\apps\phpmyadmin2.11.5\ and open 'config.inc' or 'config.inc.php'

find the line

$cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port

and fill in your port number bewteen the ''
if your port number is 3306 then leave this blank as mysql knows this by default


also check

$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address

and make sure your hostname is localhost as above.



-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------





YELLOW + WHITE WAMP ICON
-----------------------------------------------------------------------------------------------

If your wamp icon is yellow then this means that mysql service is not running.
There are a number of reasons it may not be running.

First thing to do is to try start it.

LEFT click the wamp icon, goto MYSQL, goto Service , and click Start/Resume Service.

The wamp icon will go white, and stay white if Mysql starts or it will go yellow again if the problem persists.




Next open your mysql log found at c:/wamp/logs/mysql.txt

Scroll to the bottom of the log and the last lines will hopefully contain the problem mysql is having,


The 3 most common errors are listed below

-------------------------------------------------------------------------------------
The most common is this

080410 11:37:58 [ERROR] Do you already have another mysqld server running on port: 3306 ?
080410 11:37:58 [ERROR] Aborting

This tells you that mysql is tryng to start on port 3306 but cant.
Again there are many reasons as to why this is.

1. The service mysql is blocked by a firewall
2. Port 3306 is being blocked by a firewall
3. Another program is using port 3306
4. Another copy of mysql is installed on the computer and is causing conflict.


If Windows firewall is enabled - disabled it or allow an exception for mysql on port 3306

goto CONTROL PANEL -WINDOWS FIREWALL - select OFF to disabled it

- or click the EXCEPTIONS tab at the top - Click ADD PROGRAM, browse to C:\wamp\bin\mysql\mysql5.0.51a\bin and select 'mysqld-nt' ,click open and then click ok

- Click ADD PORT,type 'mysqld-nt' into name and '3306' into port , leave TCP selected and press ok
then try restart wamp.

If you have your own firewall installed follow their instructions to replicate the results above.


Another program may be using port 3306.
To find out click start,click run, and type in 'cmd', a black console box will open.

Type in 'netstat -a' and press enter.

A list of ports being used will be displayed. Check the second column(local address) for the number 3306

If its there then another program is using the port.

You have two options-- find the program and end it or delete it if you dont use it.
- or change the port that mysql is using.

netstat may give you details on the row containing 3306 as to the program that is using it.

If not then start to end programs and process on your pc one by one and check netstat each time to see if it goes. Then you will know what program is using it.



To change the port that mysql is running on-

goto C:\wamp\bin\mysql\mysql5.0.51a and open the configuration file 'my' or 'my.ini'

The port number is written 3 times in this file

----------------
[client]

port=3306
----------------
# The TCP/IP Port the MySQL Server will listen on
port=3306
-------------------------------------------------
[mysqld]
port=3306
------------------------------------------------

3306 is the standard port for mysql. change all 3 instances of 3306 to 3307, save the file and restart wamp.

check netstat again to see if your new port 3307 shows up as listening and your wamp icon should now go white when you restart wamp.


If you have another server installed such as microsoft iis or xampp then either change your mysql port as shown above or disable or delete these servers if not used.

---------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------








This error in the log is also very common


080414 15:24:08 [ERROR] Default storage engine (InnoDB) is not available
080414 15:24:08 [ERROR] Aborting


This tells us that mysql is trying to start with InnoDB as the storage engine type and its not possible

goto C:\wamp\bin\mysql\mysql5.0.51a and open the configuration file 'my' or 'my.ini'



find these lines

# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB

and change it to

# The default storage engine that will be used when create new tables when
default-storage-engine=MyISAM


Save the file and try and restart wamp

-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------






One other error you may recieve in the log is

080415 16:03:29 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist


This means that mysql cannot find the table it uses to store usernames. it may be corrupt or deleted.

goto C:\wamp\bin\mysql\mysql5.0.51a\data\mysql and make sure you have these three files user.frm user.MYI AND user.MYD

If they are missing you can download from my server at

>>www.pampserver.com/mysqlusertable - download and replace all 3

and if they are there then they are corrupt so download them anyway - download and replace all 3

restart wamp and your icon should go white.
-------------------------------------------------------------------------------

Acknowledgement:
www.wampserver.com/forum
stevenmartin99

No comments: