Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Installing Apache, MySQL, and PHP with David Gassner describes how to install and configure Apache HTTP server, MySQL database server, and PHP, known as the AMP stack, on a local development computer. Chapters are devoted to multiple installation approaches: installing the components separately on both Windows and Mac (including coverage of Apache and PHP on Mac OS X 10.7 Lion and 10.8 Mountain Lion), installing the pre-packaged Apache and MySQL distributions in WampServer on Windows and MAMP on Mac, and installing the cross-platform XAMPP and Bitnami on both Mac and Windows. Exercise files are included with the course.
This course was updated on 07/06/2012.
You can only have one copy of MySQL and one copy of the Apache HTTP Server running at a time. If you try to install and run more than one, you'll get a port conflict. MySQL listens on Port 3306 and Apache on Port 80, and only one process can listen on each port at a time. I'll show you how to recognize and then how to resolve port conflicts on Microsoft Windows. I currently have the Local Services control panel opened, and it shows that Apache 2.2 is started and then I'll go down to MySQL and show that has started as well.
I've also installed XAMPP and WampServer. I'll start at the XAMPP Control Panel. This Control Panel shows that both Apache and MySQL are running, but notice that the Service checkboxes are selected. These reflect the native services that were installed, not the versions that were installed with XAMPP. Now I'll click the Admin button for Apache and instead of going to the XAMPP homepage as expected, I get a Not Found 404 error, indicating that the XAMPP URL wasn't found.
That's because I'm trying to navigate to the homepage on XAMPP, but instead I'm sending a request to the Apache HTTP native server. I'll prove that by going to http://localhost without the XAMPP directory and I'll get the native homepage saying, "it works!" Now, here is how you can recognize the same circumstance when trying to use WampServer. I'll double-click the WampServer icon to start up the server and then in the system tray the gauge shows red and then perhaps some other color, but it doesn't go all the way to white as it would to indicate that the servers ran successfully.
I'll click the icon and try to click Start All Services, and once again the gauge just doesn't change color. Now I'll go to the WampServer homepage and click Localhost and once again instead of getting the WampServer homepage I get the native Apache homepage. Now you can resolve this fairly easily by going into the Services control panel and stopping the services, and then you should be able to run the other versions of the services. So in the control panel I'll select Apache 2.2 and click the Stop button.
Then I'll go down to MySQL and once again I'll click Stop. Then I'll go to the WampServer icon in the system tray and choose Start All Services and now the gauge goes to all white. To show that both services that are a part of WampServer are running successfully, I'll open up phpMyAdmin. If you can get to phpMyAdmin you know that both MySQL and Apache are running successfully. Now here's another way that you can find out what's running on your system.
I'm going to stop the WampServer services and then go back to the control panel and restart both MySQL and Apache. It doesn't matter what order I start them in. Then I'll show you a trick you can do on the command line to find out whether certain ports are in use. I'll click the Windows Start button and type in cmd and open the Command application. In the Command application I'll use an application called netstat.
This is an application that's included with Microsoft Windows. It should be available on all versions of Windows including XP, Windows Vista, and Windows 7. I'll use the netstat application with a parameter of -a, which means show me all server applications listening on the TCP/IP Stack. And then after netstat -a, I'll type in a pipe character and then the Find application. This allows me to take the output of the netstat application and filter it looking for a particular string.
I'll type in the string LISTENING, in all uppercase and wrapped in quotes. Here is the result. It lists all of the ports that are currently in use on your computer. Notice port 80 is on the first line and port 3306 appears below. The exact order of the ports displayed will depend on the configuration of your computer. Now to demonstrate what happens when you shut the applications down, I'll go back to the Services panel and I'll stop Apache and MySQL. I'll come back to the Command line window.
I'll press the Up Arrow to repeat the last command and press Enter, then scroll up a bit and show that both port 80 and port 3306 have disappeared from the list. The netstat application lets you verify that those ports have been released by whatever application was using them. So that's a look at how you can recognize and then resolve port conflicts. Port conflicts occur when you install more than one copy of a server application and try to run them all at the same time.
You can easily find out what's happening and then fix the situation by knowing how to recognize the symptoms in both the server bundled applications and in the command line.
Find answers to the most frequently asked questions about Installing Apache, MySQL, and PHP.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.