Installing PHP and MySQL under Windows XP using the WinLAMP package
(Apache, PHP, MySQL, phpMyAdmin, PHP PEAR library)
What is WinLAMP?
If you want to set up a (development) server to create database-driven websites and web applications in PHP and MySQL you can use the WinLAMP package as a relatively easy way to get started.
WinLAMP installs the necessary software to run a web server and database server on your computer, i.e. the Apache webserver with the PHP module, the MySQL database, the web-based phpMyAdmin database administration tool, and finally the PHP PEAR library that contains a number of useful PHP function that, among many other things, makes working with databases easier and more portable.
However, be aware that this installation opens your computer to a number of security vulnerabilities which is why I strongly suggest that you install a personal firewall software first.
Enabling Windows XP's built-in firewall
Note: Do this only if you do not already have another firewall (e.g. Zonealarm, BlackICE) installed
- Click on the Windows "Start" button
- Right-click on "My Network Places" and select "Properties"
- Right-click on "Local Area Connection" and select "Properties"
- Click on the tab called "Advanced"
- Place a checkmark into the checkbox "Protect my computer..."
- Press the "OK" button
Downloading WinLAMP
- Open a web browser and go to: http://sourceforge.net/projects/winlamp/
- Under "Latest File Releases" click on the "Donwload" link
- Click on WinLAMP02.exe
- Choose one of the download locations and click on the little document icon next to it to start the download
- After the message box pops up click on the "Save" button
- Select "Desktop" and click on the "Save" button
Installing WinLAMP
- Double-click on the WinLAMP02 icon on your desktop
- Place a checkmark into the checkbox for "Apache + MySQL + PHP", "phpMyAdmin", and "Reboot after install"
- Click on the "Next >" button
- Make sure that the text box "Select the folder to install WinLAMP in:" reads "C:\"
- Click on the "Install" button
- After the install has finished a web browser window will open and say "WinLAMP installed successfully"
- On the install screen, click on the "Close" button and then the "OK" button
Configuring WinLAMP
Installing PEAR (The database library etc.)
- Click on the Windows "Start" button, select "Run..."
- Type: "c:\Apache\modules\php\php.exe c:\Apache\modules\php\PEAR\go-pear.php" and press the "OK" button
- After the new window opens, press the "Enter" key
- On the question about "HTTP proxy", press the "Enter" key
- On the question about installation parameters, type "1" and press the "Enter" key
- Type "c:\Apache\modules\php" and press the "Enter" key
- On the question about installation parameters, type "7" and press the "Enter" key
- Type "c:\Apache\modules\php" and press the "Enter" key
- On the question about installation parameters, press the "Enter" key
- On the question about PEAR packages bundled with PHP, press the "Enter" key ("Y" is the default)
- On the question "Would you like to alter php.ini...", press the "Enter" key ("Y" is the default)
- Press the "Enter" key
- The window should close
- Click on the Windows "Start" button, select "All Programs", "WinLAMP", "Apache Restart"
Setting up a password for MySQL
- Open a web browser and go to the web address: http://localhost/phpMyAdmin/
- In phpMyAdmin's main window click on the "Priviledges" link
- On the bottom of the "User overview" table you will see an entry listing "root localhost No..."; click on this line's "Edit" link
- On the newly opened page, under "Change Password", type and re-type a non-trivial password (such as "HDS#jw24"; but DO NOT use this exact one and write the password down so you don't forget it)
- Press the "Go" button
- Close the web browser
- Click on the Windows "Start" button, select "My Computer"
- Under "Hard Disk Drives" double-click on "C:"
- Double-click on "Apache"
- Double-click on "htdocs"
- Double-click on "phpMyAdmin"
- Right-click on the file "config.inc(.php)" and choose "Open With...", Select "Notepad" and press the "OK" button
- Scroll down and find a line that reads "$cfg['Servers'][$i]['password'] = '';" (you may want to use the "Find..." function
in the "Edit" menu)
- Modify this line to read "$cfg['Servers'][$i]['password'] = 'HDS#jw24';" (Note: Instead of the password shown here type the one you have defined using phpMyAdmin)
- From the "File" menu, select "Save" and close the Notepad editor
- Open a web browser and go to the web address: http://localhost/phpMyAdmin/
- It should now show the phpMyAdmin user interface without any error message
Using PHP, MySQL and phpMyAdmin
To create a PHP/MySQL based web application just save your files into "c:\Apache\htdocs".
You can view your web application by opening a web browser and going to: http://localhost/.