Local WordPress Development with MAMP and WampServer
When developing PHP applications or working with content management systems that require the LAMP stack (Linux, Apache, MySQL, PHP), it’s handy to have a server stack running locally. That way, you’re not dependent on a separate development server or an internet connection. If you’re adventurous, you can compile the required software from scratch, but thankfully some kind folks have made some applications to get a web server up and running fairly easily: MAMP for Mac and WampServer for Windows. Each of these is a separate desktop application that, when installed and launched, will start up a web server that includes a MySQL user and password, and PHPMyAdmin for administering your databases.
This tutorial will walk you through installing MAMP and WampServer, respectively. It will also explain some features of each, and provide brief instructions for setting up WordPress for local development.
- Download MAMP and MAMP Pro, unzip the downloaded file, and run the package installer.
- Once installed, you’ll find the application at
Applications/MAMP/MAMP. Double-click the application.
- If presented with a Warning screen, click the “Launch MAMP” option. You can uncheck the “Check for MAMP Pro” checkbox if you’d prefer.
- Click the “Start Servers” button to start your web server.
If successful, MAMP should open a new browser window pointing to a MAMP help page served locally on your computer. Note the address:
localhostis the address of your computer.
This screen presents some information about your system, including your MySQL user and password. It also presents you with a link to PHPMyAdmin.
- Now we need to create a database for our WordPress instance. Click on the PHPMyAdmin link to access your PHPMyAdmin panel. At the top of the page, you’ll see a row of tabs. Click the “Databases” tab.
- Now you’re presented with a page listing all your current databases, with a simple form above the list for creating new database. We’ll create a database called “wordpress”, and click the “Create” button. Once processed, your new “wordpress” database should appear in the list with the other databases.
You’re now ready to install WordPress and other software that runs on PHP and MySQL.
Installing WordPress on MAMP
- Download the latest version of WordPress. Alternatively, you can
check out the latest version from their Subversion repository or the
mirrored GitHub repository. If you check out the code from Subversion or GitHub, you should make sure to use a stable
taginstead of the
trunkin Subversion or
masterbranch in Github, for stability. (Tagged versions should be stable, and are never changed by the host developers.)
- Put the wordpress directory inside the
Application/MAMP. So, all your WordPress files should be at
- Inside the
wordpressdirectory, there’s a file called
wp-config-sample.php. Copy that file to a new file, and name it
Open your new
wp-config.phpfile. This is where we’ll tell WordPress how to connect to our database. There are three constants we’ll need to update:
DB_NAME(the name of our database),
DB_USER(our MySQL user), and
DB_PASSWORD(the password for our MySQL user). Where each of those is defined, we’ll change the string immediately following them to the proper values, like so:
/** The name of the database for WordPress */ define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'root'); /** MySQL database password */ define('DB_PASSWORD', 'root');
Save your changes.
- Now that we’ve given WordPress a configuration file with information to connect to our database, we should be able to go through WordPress’s “Famous 5-minute Install”. Visit to your local WordPress instance, and if WordPress finds your database successfully, you’ll be presented with a simple form to install WordPress. Fill out this form, including a site title and an admin user for WordPress (this is a different user from your MySQL user. This will be a user unique to this local installation of WordPress.) Submit the form, the click the login button to log in to your WordPress admin panel.