Configuring Magento2 using MAMP Server.

If you are using macOS, you can use MAMP to configure the Magento in the localhost.

Image for post
Image for post

In order to start running Magento, we need to have Apache2, MySQL and PHP installed. Therefore it decreases the complexity when we install a pre-configured server prior to the Magento setup.

  1. Download the MAMP server. If you are in Windows, you can proceed with the same steps by downloading the WAMP server.
  2. When you open the MAMP server, you will be redirected to the following page.

3. If you go to ‘My Website’ it will display the index of servers. Since we do not have anything right now, we will now download the Magento2x version with sample data from here.

4. You may download Magento-CE-2.3.4_sample_data-2020–01–22–11–05–42.zip something similar to this name according to the version you are downloading. Extract this to a folder called magento and copy it to /Applications/MAMP/htdocs folder.

5. Now if you go to ‘My website’, which is (http://localhost:8888), it will display a link to magento folder.

6. Click on Magento folder and it will redirect to the setup page. (http://localhost:8888/magento1/setup/#/landing-install)

7. Click on Agree and Setup Magento. First, it will check if your environment is ready for the installation. Click on ‘Start Readiness Check’.

8. Then you need to add a Database. It can be done via PhpMyAdmin which is too preinstalled with the MAMP. In order to do that go to Home Page, and click on Tools -> PHPMYADMIN. You can just create a database as magento. The tables will be automatically created while in the installation.

9. Now after we performed step 7, you will be redirected to ‘Add Database’ page. In this step, we are going to link the database that we just created. Provide the database credentials as root/root.

10. In the next step, you can configure the web configurations.

11. In the next steps you can customize the store and create admin accounts. Finally, you will be in the installation step, which may take several minutes.

12. After successful installation, you will be redirected to the page which has the URLs.

13. You can access the magento admin page by the specified URL. But there is a known bug[1] in which the admin page does not get displayed. Therefore, you need to do the following workaround and refresh the browser.

Go to /Applications/MAMP/htdocs/magento/vendor/magento/framework/View/Element/Template/File/Validator.php file.

Search for isPathInDirectories method implementation. Replace the implementation by the following code.

protected function isPathInDirectories($path, $directories)
{
$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
if (!is_array($directories)) {
$directories = (array)$directories;
}
foreach ($directories as $directory) {
if (0 === strpos($realPath, $directory)) {
return true;
}
}
return false;
}

Now you will be redirected to the Admin Page after sigining in with the admin credentials you gave in the step 11 where you can perform the operations.

Url: http://localhost:8888/magento/

[1]: https://magento.stackexchange.com/questions/252188/magento-2-2-7-admin-panel-blank-page

Written by

Senior Software Engineer — QA at WSO2

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store