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.
Regardless of how you install the Apache HTTP server, whether from a Windows binary installer or from a ZIP file, you can start and stop Apache from the command line. If you've installed using the Windows binary installer, first go to the Control Panel, and go to the Services panel. I'll go to the Control Panel and type Services, and choose View Local Services. And I'll make sure that I don't have an Apache service already installed. Now I'll go to a command prompt.
On Windows 8, I can go to the lower left corner, right click, and choose Command prompt. And if you're working on Windows 7, start the CMD application. Next, I'll switch to the Apache bin folder, this is where all the commands are stored. And I'll be using this one, httpd.exe. I'll start the server by running the command. When I run the command in this way, the command doesn't complete, it's running as an application.
Not as a service. Then I'll switch over to a browser and test, by entering localhost and pressing enter. And I see the html page with the text "It works!". I'll switch back to the command prompt, and to stop the server I'll press Ctrl+C. When the directory prompt comes back, The server has stopped. I'll come back to the browser and refresh by pressing control r and I get back an error saying that I can't get to the server now. To make it even easier to start this server from the command line, you can add the location of the HTTPD application to the environment variable path.
The system path contains names of directories that contain applications, and I'll show you how to add the Apache bin folder to this listing. Once again, I'll go to the Control Panel. In the Control Panel, I'll type environment, and I'll get to this item under system. Edit the system environment variables. I'll click to choose it, and then down here I'll click on Environment Variables. You can either set a variable for the current user or for the system, and that will affect all users.
I'll scroll down a bit and find the path, and now edit it. I'll move the cursor to end of the listing and I'll add a semi colon to the list of existing folders. Then I'll type in the name of the folder that contains my APache applications. C:\apache\bin. I'll click OK, and click OK again, and click okay one more time, and close the Control Panel. Now I'm going to close the existing command prompt window and open another one.
Now I'll try running the server by typing httpd from any folder. Just as before the command doesn't complete, and the http server should now be running. I'll come back to the browser, click the Refresh button, and I get a good response. It's working. Finally, I'll describe how to install the Apache http server as a service from the command line. I'll press Ctrl+C to stop the server, and now I'll type the following. httppd, then a space, then dash k, and another space, and install.
The first time you do this, you might see this message, indicating that access is denied, and you're being asked to log in as an administrator. To do that, I'll close that command prompt window, go back to the lower-left corner in Windows 8. And this time, I'll choose Command Prompt Admin. If you follow that step, and you see a user account control dialogue, click yes. This time I land in the Windows system 32 folder, and that's fine, and I'm going to expand the size of this font so it's a little easier to see what I'm doing.
(SOUND) And I get back the message indicating that the http server has been installed. Now, I'll go to the Services console. I'll once again go to the Control Panel, and type Services, and click View Local Services, and here's my Apache server. It's been added as a Windows service. I'll click the Start button to start the server. I'm back to the browser and refresh, and the HTML page is returned.
I'll come back to the services console and stop. I'll come back to the browser and refresh again. And I'm told that the server isn't running. Finally, I'll show how to uninstall the service. Once again I'll start in the Command prompt, running as an administrator. And I'll type httpd -k uninstall, and I get the message back that the service has been removed successfully. I'll come back to the Services console and press F5 to refresh, and I see that the service is no longer there.
So those are some of the things you can do to manage Apache from the command line. You can start and stop it, you can add the Apache bin folder to your path variable to make it easy to stop and start from anywhere on your file system, and you can add and remove it as a Windows service.
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.