MAMP is one of the popular applications to setup local server in macOS and Windows. The free version comes with all features to use single web development environment. You can use MAMP to move live WordPress site to local computer for testing and development purposes. However, when using MAMP you may need to frequently access some functions. In this article, we will explain 10 MAMP tips to work like a pro with your WordPress localhost setup.
Top 10 MAMP Tips
Here are the MAMP tips for WordPress users. However, you can use most of these tips for any other application you hosted locally using MAMP.
1. Launch WebStart Page at Startup
WebStart page is the important page to check all configuration and backend details of your localhost WordPress installation. The page also contains menu items to access local site and other useful tools quickly. Be default, MAMP allows you to launch the WebStart page at the startup. If the page does not open automatically, you can change the setup by clicking on the “Preferences” option on the app.
Under “General” tab, select “Open WebStart page” checkbox against “When starting MAMP” option.
This will automatically launch the WebStart page every time when you open MAMP. Alternatively, you can disable this option and manually launch the page by clicking on the “WebStart” button under “Preferences” section. You can also use the below URL directly on the browser’s address bar to open the startup page. This will open the page in English, ignore the parameter after ? to open the page using the default installation language.
http://localhost/MAMP/?language=English
2. Setup Favorite Link
The “General” section has an option to add your website link as a favorite link. MAMP will show this favorite link as a menu item in WebStart page. The advantage is that when you are working with your localhost, you can quickly access your live site using this favorite link.
3. Setup Ports
Many users confuse with the URL of localhost setup in MAMP. The fact is that the URL depends on the ports you choose to use for your local server. Go to “Ports” tab when you are in the “Preferences” section. Click on “MAMP default” or “80 & 3306” button to setup the server / MySQL ports accordingly.
- If you want to use the URL as http://localhost/ then setup the port as 80 and 3306. In this case, you need to use your computer’s administrator login to validate the access every time you open MAMP.
- MAMP default ports are 8888 and 8889. In this case, you need to use http://localhost:8888 as your URL.
Remember this MAMP tip as it is an important setup for accessing your localhost and also for replacing live site’s URL when migrating the live WordPress site to localhost.
4. Enable PHP Cache
By default, MAMP does not enable cache on the local server setup. However, you can enable caching under “General” section against “PHP-Cache” option. You can click on the dropdown and choose either OPcache or APC as per your need.
5. Find Document Root
Document root is the folder where you have installed the WordPress. By default, document root path in MAMP (macOS) is “Applications > MAMP > htdocs”. You can check the path under “Preferences > Server” section.
- It is also possible to change the document root by clicking on “Choose” button. However, make sure you have a WordPress installation files available on the selected location.
- Click on “Open in Finder” (for Mac) or “Open in File Explorer” (for Windows) to open the WordPress installation folder.
6. Check phpinfo
Go to the WebStart page and scroll to check under “PHP” section. Click on the phpinfo link to open the page. Alternatively, you can use the URL http://localhost/MAMP/phpinfo.php to open phpinfo file on the browser.
Phpinfo file contains all configuration information about your local server like PHP version, memory limit, max execution time, etc. You can change the values by defining parameters in wp-config.php file and test whether it works properly.
Similarly, you can the configuration values for testing and development purposes before you trying out on live server.
7. Open phpMyAdmin
This MAMP tips explains accessing the database management tool – phpMyAdmin. MySQL section on the WebStart page shows all details of your database with a link to phpMyAdmin tool. You can access phpMyAdmin to play with your local server’s database before doing the changes in live site.
Similar to other MAMP URLs, you can also access phpMyAdmin using the following URL.
http://localhost/phpMyAdmin/?lang=en
8. Simulate MySQL Queries
When you move live site to local server, the first thing to do is to replace the live URLs with localhost URLs. As mentioned above, make sure to setup “80 & 3306” ports for using http://localhost. When you are in phpMyAdmin, navigate to “SQL” section and paste the following query in the text box.
UPDATE wp_options SET option_value = replace(option_value, 'https://www.yoursitename.com', 'http://localhost') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'https://www.yoursitename.com', 'http://localhost');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'https://www.yoursitename.com','http://localhost');
Make sure to replace yoursitename.com with your actual site’s URL and click on the “Simulate query” button. This will show you how many entries will be replaced as a simulation. If you see things are correct then click on the “Go” button to execute the query on the database.
Remember, “Simulate query” option will not be available on the live database. Hence, this is very useful to test database changes before you run the queries on your live site’s database.
9. Check Documentation
MAMP has decent documentation that many users never read before using the application. When you are on the WebStart page, click on the “Tools” menu and choose “Documentation” option. This will take you to the MAMP website where you can many useful tutorials on setting up and using MAMP.
10. Changing PHP Version and Server
The final and important MAMP tips we explain here is about changing PHP version and web server. PHP is the backbone of WordPress. You have to thoroughly test entire site when changing PHP version. Therefore, changing PHP version in live site is a highly risk option that can break your site in most cases. The best solution is to use MAMP and test your site. You can change the PHP version from the dropdown on the “Preferences” section.
Similar to changing PHP version, you can also change the web server from Apache to Nginx and test the site.
Final Words
MAMP is a very useful tool for setting up local development environment. In addition to using WordPress, you can also use other applications like Drupal and Joomla. Understanding the above listed MAMP tips can help you to navigate through the application and get your tasks done quickly.
Leave a Reply
Your email is safe with us.