In a recent article, we talked about the use and advantages of having a localhost and how to have your site installed on your computer. However, it was mostly concentrating on installing WordPress offline using XAMPP which is a cross-platform application. And now, we are going to talk about how to create a localhost server with MAMP with the objective of building an offline WordPress website.
As WordPress has been built based on PHP programming language, you will need an application that installs PHP itself. Indeed, you will need to have Apache and MySQL installed on your computer. Therefore, we have decided to dedicate this article to how you could install WordPress on your Mac.
What does MAMP stand for?
As you may guess, MAMP stands for Macintosh (to be the OS), Apache (an open-source webserver), MySQL (the most famous database that WordPress sites use), and PHP (the programming language). More deeply, it is a free application that you can install on your Mac to access the local Apache server. It is one of the logical ways to create a localhost server with MAMP. Moreover, you can use XAMPP application which is a cross-platform to create a local server on your Mac.
By having all these components together installed on your computer, you can quickly build your localhost to perform your websites and applications. Going on with local projects is a logical way to check your projects before publishing them online. Therefore, you can debug your codes before going online.
Steps to Create a Localhost Server with MAMP?
1. Downloading the application
First of all, install the latest version of MAMP on your computer. You can directly go to the official website by heading over here. You need a minimum system requirement for successfully installing it:
- Operating system: Apple OS X 10.10.5 or later
- CPU: System with 64-bit CPU from Intel (×86)
2. Installing MAMP on your computer
After downloading the application, you should proceed to install it on your directory. Run the file, and the installation prompt will appear.
3. Launching MAMP from the application folder
After installing MAMP, the application will be stored in the application folder of your computer. Do not hesitate and click the MAMP folder to enter.
You will see contents like mine, as soon as you go inside the folder. Click on the icon named MAMP and the application will start. Therefore, you can see a window like below:
At first, you may see a popup window persuading you to activate the Pro version; however, you are free to ignore it.
4. Configuration To create localhost with MAMP?
4.1.Configuring the Ports
On the application window, click Preferences and select the Ports tab in the opened prompt. As you can see, we have chosen the default ports for this tutorial. However, you may want to have your ports for other purposes. So, write down 8888 for Apache Port and 8889 for MySQL Port.
4.2.Configuring the Web Server
After determining the Connection ports, click the Web Server tab to set the Web Server and document root. Make sure that Apache is selected for Web Server as we are intended to install WordPress in the following steps.
Then, the document root must be set. This is the directory where all of the job files of your local server data will be stored. The default directory is: Macintosh HD / Application / MAMP / htdocs. We won’t change that; however, you are free to set what you like.
5. Starting the server
After configuring the settings, close the prompt page by clicking the Cancel button. Then, start the server by clicking the Start Servers button. As soon as starting the server, it will turn to green as well as the Apache and MySQL Server lights on the top left side of the window that will lit up.
By clicking the Open start page, the local official page will be shown, like below:
What you see in this window is all the information that you set in the setup process.
6. Creating the database
Before going further, first, you should create your own database. It is a storage container in which all of your data stores. For both online and offline websites, you will actually need a database to store your data in it.
MySQL is one of the most popular and influential databases. It is a relational database that uses tables to store information. All the WordPress websites run on MySQL databases. However, you don’t need the details technology of the database. Just remember that all of your information such as usernames, passwords, emails, media, etc. are stored in the database.
For creating a database through MAMP procedure, create the database in phpMyAdmin section. For different websites, you will need distinct databases. You can access the phpMyAdmin by going directly to the URL or from the MAMP start page in the browser:
- Go to http://localhost:8888/phpmyadmin
- Or click on the link in the MAMP browser window
7. How to install WordPress with MAMP
What we have done is different from the way we took to install WordPress on a Windows computer. However, the further procedure (Downloading and unzipping the WordPress and the famous five-minute installation) has been discussed in our previous article. You can easily be headed there by this Link and this Link.
We reached the end! Now you know how to create localhost with MAMP. A piece of cake! We discussed the way to download MAMP from the official website, and then we showed you how to configure the application and the database. Now, it’s time for you to show us your results and share your comments.