If you’re a WordPress developer then you probably know how much quicker and easier it is to develop a theme or create a new WP site on your local machine rather than doing so on a remote server. The only slight problem with building a theme locally is that you can’t run PHP on your local browser — it’s just not supported. Fortunately, we can use MAMP to easily and efficiently create a local PHP server on your machine.
The steps to setting up your server are simple. Once you’ve installed MAMP, configure your settings as follows:
- Make sure that your ports are configured to 8888 (you’ll access your server from localhost:8888), to do this click preferences and then ports from the main MAMP dashboard
- Set your server’s document root (under the Web Server tab) to the directory that contains your WordPress install. If you have it set to another file or directory, you won’t be able to use MAMP to access your WP site.
Now that your server is configured, it’s time to set up WordPress. Click “start” on your MAMP dashboard. Set up your database by clicking the phpMyAdmin link and selecting “create new database.” Give your new database any name of your choosing.
To actually run your WordPress site, go to localhost:8888 and enter the following information into the fields you’ll find on your local server’s home page:
Database Name: yournewdatabasename
User Name (database): root
Password (database): root
Database Host/server: localhost
Table Prefix: wp_
That’s all you need to do to set up your site. Now all that’s left to do is to get to work.