On This Page
Introduction
This document describes how to install and configure PHP and MySQL on your own PC. This installation is intended only for developers and not for running in a production environment.
To run PHP with MySQL, you need to install these software components:
- Web server
- PHP engine
- MySQL database
Rather than installing each component individually, I recommend that you use an installation kit. An installation contains all the needed software components packaged with an installer program that simplifies the installation. Many installation kits are available, but the one I recommend is XAMPP from Apache Friends.
Apache Friends keeps XAMPP up to date with the latest versions of software. However, most ISPs do not use the latest versions of software. Instead, they are content with older versions (as long as they have the latest security patches). This is because major version changes may contain bugs or are incompatible with older versions of software. The customers of the ISP may need to rewrite significant amounts of code in order to migrate their Web applications to a major new version. Thus, it takes some time before ISPs migrate to major new software releases.
Most ISPs today are migrating from PHP 4 to PHP 5 and MySQL 4 to MySQL 5. We use PHP 5 and MySQL 5 in this course, but you may need to work with older versions. The installer version I recommend installs MySQL 5 and both PHP 4 and PHP 5. You can export MySQL 5 files in MySQL 4 formats. The installer lets you switch between PHP 4 and PHP 5 so you can make sure your PHP code is compatible with the version supported by your ISP.
^ top
Installation Instructions
Note: If you have an older version of XAMPP running, you will need to uninstall it before installing a newer version.
- Start the installation by downloading one of the following to a convenient location on your computer, like the Desktop. Choose the appropriate download for your type of computer:
Note: Use only these XAMPP packages and no other. Otherwise, you will install the wrong version of MySQL and have problems when you turn in your assignments.
- Depending on the type of your computer, continue the installation using one of the following links to the instructions:
- Linux: follow these instructions. Stop and return here when you get to the next section, "READ ME".
- Mac OS X: follow these instructions. Stop and return here when you get to the next section, "READ ME".
- Windows: double-click the installer and follow these instructions. Stop and return here when you get to the next section, "The Practice".
Additional notes for Windows Installation
If you install XAMPP services, then the Web server and MySQL are available when you turn your computer on. Otherwise, you must start the services with the XAMPP control panel. Thus, installing services is a matter of convenience and you can change your mind later.
For the classroom computers, please do NOT install any services. We share computers with other courses and do not want to possibly inconvenience other students.
When Windows Firewall asks if you want to keep blocking this program, press the "Keep Blocking" button as shown below. You server will still work as localhost and you really do NOT want anyone else to connect to your development server.

^ top
Testing the Installation
Once you install PHP and MySQL, you can test it by running phpMyAdamin. phpMyAdmin is a Web application written in PHP for administering the MySQL database.
Before you can run the application, you must open the XAMPP control panel and start both Apache and MySQL. If the buttons circled below are labeled Start then press them once to start the module. When started, the modules should say running and the button should say Stop as shown below.

To run the phpMyAdmin application, open a browser and type the following in the address bar:
localhost/phpmyadmin
You have successfully installed all the software if you see a Web page appear with the phpMyAdmin logo in the upper left corner.
In Case of Trouble
^ top
Securing the Installation
Once you install the server, you can optionally secure your installation. Even though you are running on localhost, your server is available to a network. At a minimum, you should have a firewall running. Also, you should not run any services that you do not need. Disabling a service is pretty good security.
Depending on the type of your computer, continue the security configuration using one of the following links to the instructions. Remember that this step is optional for home use and you can simply skip this step as long as you have a firewall installed preventing communication between your newly installed servers and the Internet or other network. In the classroom we want to leave the installation unsecured.
Additional notes for Windows Installation
If the Windows Firewall reports that it is blocking the Internet or a network from accessing Apache, press the "Keep Blocking" button.
^ top
Other Installation Kits
Here are other installation kits you look at for installing PHP and MySQL. I have included XAMPP for comparison.
Linux Installation Kits
Mac OS X Installation and Resources
Windows Installation Kits:
^ top
<< Back
Last Updated: March 06 2009 @14:35:29
|