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.
There are many great free tools to allow you to manage your MySQL databases, but one of the simplest and easiest to get started with is phpMyAdmin, a free web application which you can download from www.phpmyadmin.net. You can either go to this site and download the most recent version, or you can use the version that I've included in the free exercise files that come with this course. To use that version, go to the Free Exercise Files, to phpMyAdmin.
The entire web application is in this very small zip file. Extract the zip file, then move the resulting folder, phpMyAdmin with the version number, to your Apache document root. To do that, I'll press Command+N to create a new finder window, I'll go to the Mac hard drive root, then to Library/WebServer/Documents, and then I'm going to drag this folder into the document root. After it's been dragged into place, I'll rename it with simply phpmyadmin.
You can name the folder anything you want, but by naming it simply phpmyadmin all lowercase, it will make it very easy to access from the web browser. Now let's check a few things before we try to fire it up. Go to your System Preferences dialog and from there, to the MySQL pane, and make sure that MySQL is running. Then you can close that dialog. You're done with that for now. Then go to a browser and navigate to the URL http://localhost/phpmyadmin.
You should see this login dialog. If you try to log in right now, it's not going to work, even if you type in the correct username and password for your MySQL Installation. I will type in type in "root" and then my password and click Go, and I will see an error saying, "Cannot log in to the MySQL Server." There's also a very obscure message down at the bottom: "The mcrypt extension is missing. Please check your PHP configuration." All of these problems can be easily solved with a very small configuration file, and I have provided the most minimal version of this configuration file, again, in the free exercise files.
I'll go to the Free Exercise Files, to the phpmyadmin folder, and I am going to use this file, config.inc_MAC.php. Now I want to leave the original file in place, so I'm going to copy that to the clipboard, then I'll go back to my document root folder, to phpmyadmin, and I will paste by pressing Command+V. Now I'm going to rename the file, taking out the _MAC.
I'll click on the file once and then press Return and then remove _MAC, so that the actual name of the file is config.inc.php. Next, I am going to edit it. You can use any text editor for this purpose. And I'll show you that this file has some basic settings in it. The socket configuration on the fourth line is referring to something called a socket file, which is created automatically by MySQL when it starts up on your system.
On Mac OS X, this file is in the TMP folder. You shouldn't have to change that line at all. The next line refers to the username. I am using root, the administrative user that's created automatically when you install MySQL--and again, you can use that for local development. Next is the password. I have simply password, but you should change this to reflect your MySQL password. The next item, auth_type, changes to a different authentication model named config, and this will remove that confusing mcrypt error that you saw earlier.
And finally, there's a configuration item named AllowUserDropDatabase. By default, you as an individual user won't be able to drop or delete your own databases. I've reset that value to true. So if you need to make changes to the user and password, go ahead and do it and save your changes, but leave everything else alone and then close your text editor. Now to test go back to your browser, once again type localhost/admin, and when it opens, it may show the same screen, but press Command+R to refresh the screen and now phpMyAdmin should open correctly.
To test and make sure that you can create and delete databases, I have provided an SQL file. First click Databases and create a new database. I'm going to name it explorecalifornia and click Create. Then over on the left I will click on my new database. Now, I'm going to import some structure and data from an SQL file. I'll click Import at the top, choose File, then in my free exercise files folder, I will choose explorecalifornia.sql.
I will scroll down to the bottom and click Go, and I should see the message that the database has been imported correctly. I can go over to the left side and see the database in my list, and if the database is selected, I should be able to browse the data. Now test that you can drop the database. Up at the top of the screen, I will go to the list of my pages, and I'll click explorecalifornia, and this takes me back to the database page. I will go to the Operations screen.
I'll take a look over on the left, and I should see a link that allows me to drop the database. This is the tool that was enabled by that additional configuration in the configuration file. I will click the link and confirm and now the database is gone. So that's how you get started with phpMyAdmin. I should caution that the minimal configuration that I provided is perfectly suitable for local development. If you want to put phpMyAdmin on your production PHP server--that is, a server that's available to the public--check the phpMyAdmin documentation for the recommended configuration for a more secure installation.
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.