How to Install Magento 2 on XAMPP Server localhost

How to Install Magento 2 on XAMPP Server localhost

Installing  Magento2 on XAMPP could be pretty painful for the developers, as Magento2 requires a lot of server configurations as well as composer setup which are not set by default.

For those who are wondering, why a composer? Well, it enables us to manage the Magento system, extensions, and their dependencies. It allows us to declare the libraries for the project, depends on it will manage (install & update of the project).

Before you start installing you need the following:
1. XAMPP server installed in your computer
2. Magento 2 can be downloaded from this link Magento2.

Prerequisites

Apache Version 2.2 or 2.4
PHP 5.5.x or 5.6.x
MySQL 5.6.x

Now these are the step by step process for Installation.

Install XAMPP, Here we have used XAMPP version : 5.6.8.0 VC 11.

Magento2-Installation-Image1Extract the content of Magento 2 to htdocs folder of your XAMPP.

Prepare Installation

    • We now use composer to install the Magento software. Composer enables us to manage the Magento system, extensions, and their dependencies. It is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. To setup composer, download and run Composer-Setup.exe. It will install the latest composer version and set up your PATH so that you can just call “composer” from any directory in your command line.

Magento2-Installation-Image2It will need php.exe path to proceed the setup. Provide the path of the folder containing php.exe.

Magento2-Installation-Image3

Magento2-Installation-Image4

Magento2-Installation-Image5

  • Enable extension “php_intl.dll” by uncommenting the line “extension=php_intl.dll” in php.ini file. Just remove the semi-colon “;” from the starting of the line and restart the server from XAMMP control panel.
  • Go to Magento2 folder inside htdocs folder. Hold shift key and right click, select “open command window here”. This will open the command prompt on the location.
    • Execute the command “composer install”. This will fetch all the dependencies to install Magento 2 on your localhost.

Magento2-Installation-Image6

Magento2-Installation-Image7

    • You may be asked to provide GIT token, if you have not setup the GIT access information in the composer. Then, go to your GIT profile settings and generate an access token there.

Magento2-Installation-Image8

Magento2-Installation-Image9

    • After generating the token, copy the token and paste it into command prompt and press enter.

Magento2-Installation-Image10

Magento2-Installation-Image11

    • After fetching all the dependencies, it will generate autoload files and you are ready to install Magento 2 on localhost.

Magento2-Installation-Image12

  • Create an empty database with correct permissions in phpmyadmin.

Installation

    • Enter your Magento 2 url in browser and hit Enter.

Magento2-Installation-Image13

    • Click on “Agree and Setup Magento”.

Magento2-Installation-Image14

    • Now Magento 2 will check your environment for readiness for the setup. Click on “Start readiness check”.

Magento2-Installation-Image15

    • Now enter Empty database that you created previously, where you want to install Magento2.

Magento2-Installation-Image16

  • Click Next, now you will be asked for web configurations like store url, admin url, Apache rewrites, https options.
    • Click Next, now you can select Timezone, Currency and language in “Customize Your Store” section.

Magento2-Installation-Image17

    • Click Next, Enter Admin username, email and password to setup Admin credentials.

Magento2-Installation-Image19

    • Click Next, Voila J, Now Magento 2 is ready to be installed on localhost. Click on “Install Now”. Don’t close your browser until setup is done.

Magento2-Installation-Image20

Magento2-Installation-Image21

    • After the installer has completed the setup, it will show Success page.

Magento2-Installation-Image22

    • Open Magento Admin panel, enter your admin credentials given at the time of setup.

Magento2-Installation-Image22

    • And open your homepage.

Magento2-Installation-Image23

While Installing it, If you have faced any problem let me know after doing comment below, So that i can help you.

integrate-magento-with-erp-appseconnect

You may also like this:
Important Things to Remember When Pricing a New Product
How to ensure After Sales satisfaction to Customers

  • an3s

    After install when i go to admin login i get a blank screen. i did everything you said.

  • an3s

    After install when i go to admin login i get a blank screen. i did everything you said.

  • Ezeaniekwe Chibunna Ferdinand

    How can I import the sample data, Am installing on my local host! I taught am supposed to import a database file from somewhere. Thanks for your assistance

    • In windows, open cmd in php folder inside your server folder and run this command.

      mysql -h 127.0.0.1 -u root -p magento2 < "database dump file path"

  • Ezeaniekwe Chibunna Ferdinand

    Ahh! I read your write up words-for-words and followed the screen shots and I have successfully installed Magento 2.0 with sample data. Thanks

    • Thanks for the read Ferdinand. Let me know if you have any queries.

  • Ezeaniekwe Chibunna Ferdinand

    I cannot login into my magento admin section, I got this error

    This webpage has a redirect loop

    ERR_TOO_MANY_REDIRECTS

    Here is my login link : http://localhost/magento2/admin/admin/index/index/key…..( Keys Removed)

    Am working on a xampp windows local host

  • Tharaka Madhusanka

    I am running apache server in port 81 and so the localhost thing work as localhost:81 ! When I try to install magento i can’t install it ! I created magento database in mysql and filled the installation form as in the way.

    1. what should I type as the Localhost ? Localhost or localhost:81
    2. What should be the database user ? root or any

    explain please !!!

    Thank You !

    • put locahost:81 or 127.0.0.1:81

      For database you can go with username root and blank password, in case you have created any user for that, you can put your credentials over there.

  • Turki Tarak

    Hi im stuck and need help plz to install magento : im using apach 2.4.9 and php 5.5.12 and mysql 5.6.17 . the issue was in this message and cant understand it :
    ” Warning: require(C:wampwwwmagentovendor/magento/module-media-storage/registration.php): failed to open stream: No such file or directory in C:wampwwwmagentovendorcomposerautoload_real.php on line 59″

    “( ! ) Fatal error: require(): Failed opening required ‘C:wampwwwmagentovendor/magento/module-media-storage/registration.php’ (include_path=’C:wampwwwmagentovendor/phpseclib/phpseclib/phpseclib;C:wampwwwmagentovendor/magento/zendframework1/library;C:wampwwwmagentovendor/phpunit/php-file-iterator;C:wampwwwmagentovendor/phpunit/phpunit;C:wampwwwmagentovendor/symfony/yaml;.;C:phppear’) in C:wampwwwmagentovendorcomposerautoload_real.php on line 59”
    please need help .thank u

  • Ericka Che

    It happens to me that was installed correctly magento, but when entering the admin panel images magento broken out and it works just the dashboard button, the rest of the other buttons do not respond.

    • Do you get any error on console ? Check file permissions for your images.

    • Rifan Herriyadi

      Me too, it happened to me. can anybody give me solution step by step

    • Hassan Aljeshi

      If anyone came from a google search and facing the same problem with the images not showing, the solution is to deploy static content.

      To do this open the command line in the /bin and issue the following command:
      php magento setup:static-content:deploy

  • Aljaž Turk

    Thanks for this tutorial, helped me a lot.

  • Jaydipsinh parmar

    after sucessfully install open admin panel

    Apache HTTP Server has stopped working error display me.

    What is the solution

  • sommy

    i had this error when executing command line

    Problem 1
    – The requested PHP extension ext-xsl * is missing from your system. Install or enable PHP’s xsl extension.

    C:xampphtdocsmagento2-develop>

  • Iuri

    Best windows tutorial i’ve found. Thanks
    Do you have any on Linux?

    • Thanks Luri. We will soon publish an article for Linux. For the mean time please try XAMPP for Linux OR you can use LAMP.