How to install Magento 2 using Composer

Last updated on May 31 2022
Raghvendra Wanchoo

Table of Contents

How to install Magento 2 using Composer

In this blog, we are going to discuss the installation of Magento 2.3.2 using composer on windows. Here, we are installing the latest version of Composer, i.e., v1.9.0. Before installing the composer, XAMPP must be installed on our system, otherwise we are not able to use the composer.

Pre-requisites

  • PHP – PHP 5.6+
  • Database – MySQL 5.6+
  • Web Server – Apache 2.2x or Nginx 1.7x
  • Operating System – Cross-platform
  • Brower – Google Chrome, Internet Explorer, or Firefox, etc.
  • Secure Socket Layer (SSL) – A valid security certificate for HTTPS
  • XAMPP – XAMPP 7.2.1+ (PHP, MySQL, Apache)

Step 1: Download the composer 1.9.0 from the following site https://getcomposer.org/download/. Click on Composer-Setup.exe to download the composer for windows, as mention in the below screenshot.

image1 10
Step 2: After downloading the composer, double click on the downloaded file to run. Now, click on Run.

 

image2 10

 

Step 3: If you are a beginner, then leave the Developer mode uncheck and click next. Developer mode is a bit advanced so, if you are a beginner, do not check the box.

image3 10

Step 4: Browse the location where you want to install the setup of the composer. By default, it takes C drive. For more convenience, install the composer setup in the same drive, where you installed XAMPP.

image4 10

Step 5: There is no need to change anything. Click Next to Continue. You must have to install PHP on your system before installing composer.

image5 10

Step 6: Here, you can leave it empty. So, click on Next to Continue.

image6 9

Step 7: The wizard below will show the PHP version of what we are going to use, i.e., 7.2.22 for our current tutorial. Click on Next and move ahead.

image7 9

Step 8: Click on Next to Continue.

image8 9

Step 9: Installation is completed. Composer setup is successfully installed on the system. So, click on the Finish button.

image9 7

Step 10: Open the command prompt and type a command composer. If the output will show same as the below screenshot, then the composer is successfully installed.

image10 6

Now, we will install the latest version of Magento, i.e., Magento 2.3.2.

Step 11: Download the Magento 2.3.2 from https://magento.com/tech-resources/download. Select the format of Magento before clicking on download.

image11 5
Step 12: Select the zip format of Magento for windows platform, and then click on download.

image12 5
Step 13: Before downloading the Magento, it will ask you to login. Login with registered email and password if you are an existing user, otherwise create a new account. Click on Create a new account for the new user.

image13 5

Step 14: Enter the details correctly here and create a new account.

image14 4

Step 15: Now, login with the email and password after creating the account, and click on Login and Download. Downloading will automatically start.

image15 3
Step 16:Now, create a new folder by the name magento2 in htdocs folder inside xampp, i.e., xampp -> htdocs.

image16 3
Step 17: Extract the downloaded Magento 2.3.2 zip file in magento2 folder, which you have created in the previous step. To extract the zip file right click on the downloaded file and select extract file, then provide the path for extraction.

image17 3
Step 18: Now, open the command prompt. Firstly change directory to C:\xampp\htdocs\magento2, where you extract the Magento, and then run a command composer install on command prompt.

image18 3
Step 19: Run another command php bin/magento setup:install on command prompt. It will show an error that xsl, intl, and soap extensions are missing.

image19 3
Step 20: To remove extension missing error, open php.ini file in notepad inside the xampp -> apache -> config -> PHP (php.ini).

image20 3

Step 21: Find
;extention = intl
;extension = soap
;extension = xsl in php.ini file and remove the semicolon before these extensions. Save the file.

image21 3

Step 22: Again execute php bin/magento setup:install on command prompt. It will show another error that the database with magento2 name does not exist. So, create a database by the name magento2 in phpMyAdmin.

  • Type localhost/phpmyadmin/ in the browser and press enter.
  • Click on new, and enter the database name as magento2 and click on Create button.

image22 3

Step 23: Now run the below command on command prompt, by changing as per your magento and database configuration.

  1. php bin/magento setup:install --base-url=http://localhost /magento2 --db-host="name localhost" --db-name="name DB" --db-user="db username" --db-password="db password" --admin-firstname="firstname" --admin-lastname="lastname" --admin-email=admin@domain.com --admin-user="username" --admin-password="userpass" --language="en_UK" --currency="INR" --timezone="Asia/Kolkata" --use-rewrites="1"

image23 3

Now the installation of Magento is started in your system

Step 24: You can see that the installation is completed. Note down the Admin URL from here.

image24 2
Step 25: Magento 2.3.2 is installed successfully. Now, open the browser and type Magento Admin Address – localhost/magento2/admin_nknghg/ Store address (front end) – localhost/magento2/ in separate tab.

Magento Admin Panel

image25 2

If the admin login panel does not open and shows a blank screen on the browser by the Magento admin address URL, then follow the below instructions.

  • Go inside the xampp/htdocs/magento2/vendor/magento/framework/View/Element/Template/File/Validator.php
  • Open the Validator.php file.
  • Find the given code inside the Validator.php file, and

Replace code

  1. foreach($directories as $directory) {
  2. if ( 0 == strops ( $realPath, $directory )) {
  3. return true;
  4. }
  5. }

Replace with

  1. foreach($directories as $directory) {
  2. $realDirectory = this -> fileDriver -> getRealPath ($directory);
  3. //here, $directory is replaced with $realDirectory
  4. if ( 0 == strops ( $realPath, $realDirectory )) {
  5. return true;
  6. }
  7. }

Now, save the validator.php file and reload the Admin page. The admin panel is visible properly.

image26 1

Luma theme

The front end interface is missing the Luma logo using store address, and the page will display like the below screenshot, then follow below step to fix the error.

image27 1

  1. Open di.xml file inside xampp/htdocs/magento2/app/etc/di.xml
  2. Search Symlink inside the di.xml file as given in the screenshot.
  3. Replace the word “Symlink” with the “Copy” in the file and save the file.
  4. Reload the home page. Now, the Luma theme (front end) will visible properly.

After removing all errors, installation of Magento 2.3.2 is completed here, and now all components of Magento are working properly.

image28 1

 Errors while installing Magento 2

Admin login panel is not visible

After installing Magento 2.3.2 successfully on the system sometimes you face layout crashing error. As the admin login page is not opened properly and it seems blank like the below screenshot:

image29 1

To fix this, follow the given instructions below:

  • Go inside the xampp/htdocs/magento2/vendor/magento/framework/View/Element/Template/File/Validator.php
  • Open the Validator.php file.
  • Find the given code inside the Validator.php file, and
  • Replace this code
  1. foreach($directories as $directory) {
  2. if ( 0 == strpos ( $realPath, $directory )) {
  3. return true;
  4. }
  5. }
  • Replace the above code with the code given below and save the file.
  1. foreach($directories as $directory) {
  2. $realDirectory = $this -> fileDriver -> getRealPath ($directory);
  3. //here, $directory is replaced with $realDirectory
  4. if ( 0 === strpos ( $realPath, $realDirectory)) {
  5. return true;
  6. }
  7. }

Now, reload the webpage the admin login panel will be visible.

Front end/ Luma theme is not visible

If the front end interface is missing, and the store page will be visible like this rather than the Luma theme, then follow the below instructions:

Follow the below instructions to fix the error.

  • Open di.xml file inside xampp/htdocs/magento2/app/etc/di.xml
  • Search Symlink inside the di.xml file as given in the screenshot.
  • Replace the word “Symlink” with the “Copy” in the file and save the file.
  • Reload the home page. Now, the Luma theme (front end) will visible properly.

image30 1

PHP extensions are missing

While installing Magento 2, the first step is Readiness Check, where you will find an error that three PHP extensions are missing. These three missing extensions are xsl, soap, and intl. So, to remove these errors follow the given instructions.

  • Open php.ini file from XAMPP i.e., Apache -> Config -> PHP (php.ini). See in below screenshot.
  • Find:
    ;extension = intl
    ;extension = soap
    ;extension = xsl
  • Remove the semicolon (;) before from all three extensions and save the file.
  • Restart the XAMPP server and try Readiness Check again. This time Readiness Check will complete without any error.

Dashboard icons are not working

The menu slide bar from the back end dashboard is not responding. You can see at the left side in the given screenshot.

Follow the below instructions to fix it.

  • Open di.xml file inside xampp/htdocs/magento2/app/etc/di.xml
  • Search Symlink inside the di.xml file as given in the screenshot.
  • Replace “Symlink” with the “Copy” in the file and save the file.
  • Reload the dashboard. Now, all the icons in the menu slide bar will work properly.

So, this brings us to the end of blog. This Tecklearn ‘How to install Magento 2 using Composer’ blog helps you with commonly asked questions if you are looking out for a job in Magento Programming. If you wish to learn Java and build a career Java Programming domain, then check out our interactive, Java and JEE Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

https://www.tecklearn.com/course/java-and-jee-training/

Java and JEE Training

About the Course

Java and JEE Certification Training is designed by professionals as per the industrial requirements and demands. This training encompasses comprehensive knowledge on basic and advanced concepts of core Java & J2EE along with popular frameworks like Hibernate, Spring & SOA. In this course, you will gain expertise in concepts like Java Array, Java OOPs, Java Function, Java Loops, Java Collections, Java Thread, Java Servlet, and Web Services using industry use-cases and this will help you to become a certified Java expert.

Why Should you take Java and JEE Training?

  • Java developers are in great demand in the job market. With average pay going between $90,000/- to $120,000/- depending on your experience and the employers.
  • Used by more than 10 Million developers worldwide to develop applications for 15 Billion devices.
  • Java is one of the most popular programming languages in the software world. Rated #1 in TIOBE Popular programming languages index (15th Consecutive Year)

What you will Learn in this Course?

Introduction to Java

  • Java Fundamentals
  • Introduction to Java Basics
  • Features of Java
  • Various components of Java language
  • Benefits of Java over other programming languages
  • Key Benefits of Java

Installation and IDE’s for Java Programming Language

  • Installation of Java
  • Setting up of Eclipse IDE
  • Components of Java Program
  • Editors and IDEs used for Java Programming
  • Writing a Simple Java Program

Data Handling and Functions

  • Data types, Operations, Compilation process, Class files, Loops, Conditions
  • Using Loop Constructs
  • Arrays- Single Dimensional and Multi-Dimensional
  • Functions
  • Functions with Arguments

OOPS in Java: Concept of Object Orientation

  • Object Oriented Programming in Java
  • Implement classes and objects in Java
  • Create Class Constructors
  • Overload Constructors
  • Inheritance
  • Inherit Classes and create sub-classes
  • Implement abstract classes and methods
  • Use static keyword
  • Implement Interfaces and use it

Polymorphism, Packages and String Handling

  • Concept of Static and Run time Polymorphism
  • Function Overloading
  • String Handling –String Class
  • Java Packages

Exception Handling and Multi-Threading

  • Exception handling
  • Various Types of Exception Handling
  • Introduction to multi-threading in Java
  • Extending the thread class
  • Synchronizing the thread

File Handling in Java

  • Input Output Streams
  • Java.io Package
  • File Handling in Java

Java Collections

  • Wrapper Classes and Inner Classes: Integer, Character, Boolean, Float etc
  • Applet Programs: How to write UI programs with Applet, Java.lang, Java.io, Java.util
  • Collections: ArrayList, Vector, HashSet, TreeSet, HashMap, HashTable

Java Database Connectivity (JDBC)

  • Introduction to SQL: Connect, Insert, Update, Delete, Select
  • Introduction to JDBC and Architecture of JDBC
  • Insert/Update/Delete/Select Operations using JDBC
  • Batch Processing Transaction
  • Management: Commit and Rollback

Java Enterprise Edition – Servlets

  • Introduction to J2EE
  • Client Server architecture
  • URL, Port Number, Request, Response
  • Need for servlets
  • Servlet fundamentals
  • Setting up a web project in Eclipse
  • Configuring and running the web app with servlets
  •  GET and POST request in web application with demo
  • Servlet lifecycle
  • Servlets Continued
  • Session tracking and filter
  • Forward and include Servlet request dispatchers

Java Server Pages (JSP)

  • Fundamentals of Java Server Page
  • Writing a code using JSP
  • The architecture of JSP
  • JSP Continued
  • JSP elements: Scriptlets, expressions, declaration
  • JSP standard actions
  • JSP directives
  • Introduction to JavaBeans
  • ServletConfig and ServletContext
  • Servlet Chaining
  • Cookies Management
  • Session Management

Hibernate

  • Introduction to Hibernate
  • Introduction to ORM
  • ORM features
  • Hibernate as an ORM framework
  • Hibernate features
  • Setting up a project with Hibernate framework
  • Basic APIs needed to do CRUD operations with Hibernate
  • Hibernate Architecture

POJO (Plain Old Java Object)

  • POJO (Plain Old Java Object)
  • Persistent Objects
  • Lifecycle of Persistent Object

Spring

  • Introduction to Spring
  • Spring Fundamentals
  • Advanced Spring

Got a question for us? Please mention it in the comments section and we will get back to you.

 

0 responses on "How to install Magento 2 using Composer"

Leave a Message

Your email address will not be published. Required fields are marked *