Table of Contents
Introduction
In this tutorial, we will learn how to install Magento Open Source 2.4.9 on Windows using XAMPP and Composer.
We will cover the complete installation process, including environment setup, PHP configuration, Composer installation, database configuration, Magento package installation, and storefront access.
Each step includes commands, configuration instructions, and screenshots to help developers follow along easily.
Table of Contents
- Prerequisites for Installing Magento 2.4.9 on Windows
- Download and Install XAMPP
- Install and Configure Composer
- Install and Configure OpenSearch 3
- Configure PHP for Magento 2.4.9
- Configure MySQL Database
- Download Magento 2.4.9 Using Composer
- Install Magento Using Command Line
- Configure Apache Virtual Host
- Access Magento Storefront and Admin Panel
- Troubleshooting Common Installation Errors
- Conclusion
1. Prerequisites for Installing Magento 2.4.9 on Windows
Before installing Magento Open Source 2.4.9 on Windows, we need to prepare the development environment and ensure that all required software and dependencies are available.
Magento uses several technologies to manage its application, database, search functionality, and package dependencies. We will use XAMPP for the local Apache and PHP environment, Composer to download Magento, and OpenSearch for catalog search.
The following software is required for this installation:
| Software | Required Version | Purpose |
|---|---|---|
| Windows | Windows 10/11 64-bit | Operating system |
| XAMPP | Compatible PHP 8.5 build | Local Apache and PHP environment |
| PHP | 8.5 | Magento application runtime |
| Composer | 2.10 | PHP dependency management |
| MySQL | 8.4 | Database management |
| OpenSearch | 3.x | Catalog search functionality |
| Apache | XAMPP bundled version | Local web server |
Note: Magento 2.4.9 also supports MariaDB 12.3. However, XAMPP bundles MariaDB rather than MySQL, so check its exact version before using it. For this tutorial, we will use a separately installed MySQL 8.4 database if the bundled MariaDB version is incompatible.
2. Download and Install XAMPP on Windows
XAMPP is a local development environment that provides Apache, PHP, MariaDB and phpMyAdmin. It allows developers to run PHP applications locally without configuring a web server manually.
In this section, we will download and install XAMPP on Windows and verify that Apache and PHP are working correctly.
Download XAMPP
Download the Xampp installer to your computer : Click Here to Download XAMPP 8.5.12
3. Install and Configure Composer on Windows
Composer is a dependency management tool for PHP. It helps developers install, update and manage the PHP libraries and packages required by an application.
Magento uses Composer to download its core application packages, third-party dependencies and extensions.
In this section, we will install Composer on Windows and configure it to use the PHP executable bundled with XAMPP.
3.1 Download Composer
Let’s Download Composer: Click Here to Download Composer
3.2 Install Composer
Once the download is complete, follow these steps:
Step 1: Double-click Composer-Setup.exe to start the installation.
Step 2: Select the installation type.
Choose the recommended option:
Install for all users (recommended)
Click Next to continue.
Step 3: The installer will ask you to locate the PHP executable.
Select the PHP executable from your XAMPP installation directory.
For example:
C:\xampp\php\php.exeClick Next to continue.
Important: Make sure you select the PHP executable from your XAMPP installation. This ensures Composer uses the same PHP version as your local development environment.
Step 4: Review the PHP configuration and proxy settings.
If you are not using a proxy server, leave the proxy configuration disabled and continue.
Step 5: Review the installation settings and click Install.
Step 6: Wait for Composer installation to complete.

Step 7: Click Finish to close the installer.
Close any previously opened Command Prompt windows and open a new Command Prompt so that the updated system PATH is loaded.
3.3 Verify Composer Installation
After completing the installation, we need to verify that Composer is installed and working correctly.
Step 1: Open Command Prompt.
Step 2: Execute the following command:
composer --versionYou should see output displaying the installed Composer version.

Since we are setting up Magento 2.4.9 on Windows using XAMPP, we will use Composer 2.10.3 for this installation to maintain a consistent and reproducible development environment.
Run below command prompt using Administrator Previlege:
composer self-update 2.10.3
You will see the output as below:

4. Install and Configure OpenSearch 3
Step 1: Download OpenSearch 3:
Lets download OpenSearch 3 : Click Here to download OpenSearch 3
Step 2: Extract OpenSearch
After downloading:
Open your Downloads folder.
Right-click the ZIP file.
Select Extract All.
Extract it to:
C:\xampp\htdocs\opensearch-3.10.0
Step 3: Configure OpenSearch
Open:
C:\xampp\htdocs\opensearch-3.10.0\config\opensearch.ymlFor local Magento development, we’ll disable the security plugin to simplify the connection.
Add these settings at the end of the file:
cluster.name: magento-cluster
node.name: magento-node
network.host: 127.0.0.1
http.port: 9200
discovery.type: single-node
plugins.security.disabled: trueSave the file.
Step 4: Configure Java heap memory
Open:
C:\xampp\htdocs\opensearch-3.10.0\config\jvm.optionsFind:
-Xms1g
-Xmx1gFor a local development environment, 1 GB is a reasonable starting point if your computer has sufficient memory.
Keep both values equal.
Save the file.
Step 5: Start OpenSearch
Open Command Prompt as Administrator.
Execute:
cd C:\xampp\htdocs\opensearch-3.10.0\binStart OpenSearch:
opensearch.bat
Wait until OpenSearch finishes initializing. Keep this terminal window open while using Magento.
Step 6: Verify OpenSearch installation
Open another Command Prompt window.
Execute:
curl.exe http://localhost:9200You should receive a JSON response similar to:

5. Configure PHP for Magento 2.4.9
PHP is the core programming language used by Magento. Before installing Magento Open Source 2.4.9, we need to configure PHP and enable the required PHP extensions.
Since we are using XAMPP on Windows, we will configure PHP using the php.ini configuration file available in the XAMPP installation directory.
5.1 Locate the PHP Configuration File
First, we need to locate the php.ini file used by XAMPP.
By default, the PHP configuration file is located at:
C:\xampp\php\php.iniFollow these steps:
Open the XAMPP installation directory.
Navigate to the
phpfolder.Locate the
php.inifile.Open the file using Notepad or Visual Studio Code.
Alternatively, you can open the PHP configuration file directly from the XAMPP Control Panel.
Click the Config button next to Apache and select PHP (php.ini).

5.2 Enable Required PHP Extensions
Magento requires several PHP extensions to perform operations such as database connectivity, image processing, encryption, XML processing and HTTP requests.
Open the php.ini file and locate the following extensions.
The extensions required by Magento Open Source 2.4.9 include:
The following PHP extensions must be available:
| PHP Extension | Purpose |
|---|---|
| bcmath | Mathematical calculations |
| ctype | Character type checking |
| curl | HTTP requests and API communication |
| dom | XML and HTML document processing |
| fileinfo | File type detection |
| ftp | FTP operations |
| gd | Image processing |
| intl | Internationalization |
| mbstring | Multibyte string handling |
| openssl | Encryption and security |
| pdo_mysql | MySQL database connectivity |
| simplexml | XML processing |
| soap | SOAP API communication |
| sockets | Network socket operations |
| sodium | Cryptographic operations |
| xsl | XML transformations |
| zip | ZIP archive handling |
Some extensions, such as ctype, dom, hash, iconv, json, libxml, pcre, reflection, spl, tokenizer, xmlwriter and zlib, are already provided by PHP or compiled into it. They do not necessarily require separate entries in php.ini.
How to enable PHP extensions
Step 1: Open the php.ini file.
Step 2: Search for the extension you want to enable.
For example:
;extension=curlStep 3: Remove the semicolon (;) from the beginning of the line.
extension=curlStep 4: Repeat this process for any required extensions that are currently disabled.
For example:
extension=bcmath
extension=curl
extension=ftp
extension=gd
extension=intl
extension=mbstring
extension=openssl
extension=pdo_mysql
extension=soap
extension=sockets
extension=sodium
extension=xsl
extension=zipMake sure the corresponding extension DLL files are available in the XAMPP PHP ext directory.
Step 5: Save the php.ini file.
5.3 Configure PHP
Magento requires sufficient PHP memory to execute installation commands, compile code and generate static content.
max_execution_time=18000 max_input_time=1800 memory_limit=4G
5.4 Enable and Configure OPcache
OPcache improves PHP performance by storing precompiled PHP bytecode in memory.
Locate the OPcache configuration in php.ini.
Make sure the following settings are enabled:
opcache.enable=1
opcache.enable_cli=1
opcache.save_comments=1The opcache.save_comments setting must remain enabled because Magento uses PHP code comments for code generation.
5.5 Save Changes and Restart Apache
After updating the PHP configuration:
- Save the
php.inifile. - Open the XAMPP Control Panel.
- Stop Apache.
- Start Apache again.
This ensures Apache loads the updated PHP configuration.
6. Configure MySQL Database for Magento 2.4.9
Magento requires a database to store important application information, including products, categories, customers, orders, configurations and website settings.
In this section, we will configure the database required for our Magento Open Source 2.4.9 installation using XAMPP on Windows.
n Xampp interface, open PHPmyadmin by clicking on Admin button to open phpmyadmin (you can also type: localhost/phpmyadmin/ in browser to access phpmyadmin)

On phpmyadmin page, click on New => type database name => click on Create to create a new database. For example, I create magento2 database here

By default, Xampp does not set a password for MYSQL, so we will need to create a new root password for mysql.
On Xampp, click on Shell button to open command interface

Next, input the following command to change mysql root password
mysqladmin.exe -u root password yourpassword
Replace yourpasswordwith your desired password. I put root as password.
Now, to use phpmyadmin, you will also need to enter the new password. To make phpmyadmin automatically login with your new password, go to C:\xampp\phpMyAdmin\config.inc.php and insert your new password here


7. Download and Install Magento 2.4.9 Using Composer
Composer is used to download Magento Open Source and manage its required PHP packages and dependencies.
7.1 Download Magento 2.3.9 using composer
In command prompt, cd C:\xampp\htdocs,
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.9 magento2
magento2 – is the folder name
If the Private and Public keys asked then follow step 7.2 as given below.
7.2 Generate Composer Authentication Keys
Create an account on Magento marketplace and go to https://marketplace.magento.com/customer/accessKeys/ to get private and public access key.
Follow these steps:
Click your account name in the top-right corner.
Select My Profile.
Navigate to the Marketplace tab.
Open Access Keys.
Click Create a New Access Key.
Enter a name for your key pair, such as
Magento249-Windows.- Click OK.If Private and Public key asked then follow below steps:


Adobe will generate two authentication keys:
Public Key: Used as the Composer username.
Private Key: Used as the Composer password
Successful download looks like this

Now, see the magento2 folder with all files and folders.
7.3 Set Document Root
We need to set document root, to do this go to file C:\xampp\apache\conf\extra\httpd-vhosts.conf
Add this content in the bottom of the file.
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/magento2/pub"
ServerName yourname.magento.com
</VirtualHost><VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>Where,
DocumentRoot "C:/xampp/htdocs/magento2/pub"=> location of the magento2 folder path
Save the file and again run the magento2 install command in the command prompt.
Once the complete installation finished, you will see below screen













