Magento

Magento 2.4.7 Installation on Windows Machine – Step By Step Tutorial (2025)

Installing Magento 2.4.7 on a Windows machine can seem complex, but with the right steps, you can have your eCommerce store up and running quickly. First, set up your local development environment by installing XAMPP, WAMP, or any suitable LAMP stack. Ensure PHP 8.1 or later is installed, as Magento 2.4.7 requires compatibility with specific PHP extensions like soap, gd, intl, and sockets. Next, configure Apache and MySQL within the stack and update the php.ini file by increasing the memory limit to 4GB, enabling essential extensions, and setting execution time limits. After configuring your server environment, create a virtual host for Magento by editing the httpd-vhosts.conf file and mapping it to a custom domain like magento.local. Don’t forget to update the hosts file in C:\Windows\System32\drivers\etc to point your domain to 127.0.0.1. Once the environment is ready, download and install

Composer, a dependency manager, and fetch Magento 2.4.7 using access keys from Magento Marketplace. During installation, configure database credentials, admin details, and set up Elasticsearch 7.x, a mandatory search engine for Magento. Run the setup commands to install Magento, reindex data, and deploy static content. Finally, disable two-factor authentication if required and troubleshoot any issues related to file paths or permissions. With Magento installed, you can access the admin panel and storefront, ready to customize your site and launch your online business. This streamlined process ensures optimal performance and compatibility on a Windows system.

1. Install Composer


2. Windows Environment Setup

  1. Edit hosts File:
    • Open C:\Windows\System32\drivers\etc\hosts.
    • Add the following line:
      127.0.0.1 acesoftech.local

3. XAMPP Configuration

  1. Edit php.ini File:
    • Open C:\xampp\php\php.ini.
    • Enable the following PHP extensions:
      extension=soap
      extension=sockets
      extension=sodium
      extension=sqlite3
      extension=tidy
      extension=xsl
      extension=zip
      extension=gd
      extension=intl

      Increase memory limit:

      memory_limit = 4G
  2. Create Virtual Host:Edit C:\xampp822\apache\conf\extra\httpd-vhosts.conf and add the following configuration:
    apache
    <VirtualHost *:80>
    DocumentRoot "C:/xampp822/htdocs/magento/pub"
    ServerName acesoftech.local
    <Directory "C:/xampp822/htdocs/magento/pub">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
    </Directory>
    </VirtualHost>
    • Restart Apache using the XAMPP Control Panel.

4. Obtain Magento Access Keys

  • Create an Account on Magento Marketplace:
    • Go to Magento Marketplace.
    • Click on Sign In > Create an Account and complete the registration.
  • Obtain Access Keys:
    • Go to My Profile > Access Keys (under the Marketplace tab).
    • Click Create a New Access Key and name it (e.g., “Magento Setup Key”).
    • Save the Public Key (username) and Private Key (password).

5. Download and Install Magento

  1. Configure Composer:
    composer global config http-basic.repo.magento.com <public_key> <private_key>

    Replace <public_key> and <private_key> with your Magento access keys.

  2. Create Magento Project:
    composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition magento

For specific Version :  composer create-project –repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.6 magento


6. Install Elasticsearch

  1. Download Elasticsearch:
  2. Configure Elasticsearch:
    • Extract Elasticsearch to C:\xampp822\htdocs\elasticsearch-7.16.3.
    • Open a terminal and navigate to the bin folder:
      bash
      cd C:\xampp822\htdocs\elasticsearch-7.16.3\bin
    • Run Elasticsearch:
      bash
      elasticsearch.bat
    • Test Elasticsearch by visiting http://localhost:9200 in your browser.

 

sample elasticsearch.yml code

cluster.name: my-application
node.name: node-1
path.data: C:/xampp822/htdocs/elasticsearch-7.16.3/data
path.logs: C:/xampp822/htdocs/elasticsearch-7.16.3/logs
bootstrap.memory_lock: true
network.host: 127.0.0.1
http.port: 9200
action.destructive_requires_name: true

7. Create Database

go to phpmyadmin and create one database

7. Troubleshoot Issues

  1. Fix Gd2.php Validation Issue: Modify the function validateURLScheme in vendor\magento\framework\Image\Adapter\Gd2.php:

    private function validateURLScheme(string $filename) : bool   {
              $allowed_schemes = ['ftp', 'ftps', 'http', 'https'];
              $url = parse_url($filename);
              if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes) && !file_exists($filename)) {
                  return false;
              }
    
              return true;   
    }

  2. Modify di.xml (Symlink to Copy):
    • Open app/etc/di.xml.Replace:

      Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink

       

    • With:
      Magento\Framework\App\View\Asset\MaterializationStrategy\Copy
  3. Fix File\Validator.php Issue: Modify C:\xampp\htdocs\magento\vendor\magento\framework\View\Element\Template\File\Validator.php:

    $realPath = $this->fileDriver->getRealPath($path);
    
    foreach ($directories as $directory) {
        // Get the real path of each directory in the list
        $directoryRealPath = $this->fileDriver->getRealPath($directory);
        
        // Check if the real path of the file starts with the real path of the directory
        if ($directoryRealPath !== false && strpos($realPath, $directoryRealPath) === 0) {
            return true;
        }
    }
    
    return false;
    

 

4. PluginListGenerator.php error while DI compile

Go to – vendor\magento\framework\Interception\PluginListGenerator.php

 

Find -> $cacheId = implode('|', $this->scopePriorityScheme) . "|" . $this->cacheId;

Replace -> $cacheId = implode('-', $this->scopePriorityScheme) . "-" . $this->cacheId;

 


8. Install Magento

Run the setup command:

php bin/magento setup:install \
--base-url="http://acesoftech.local/" \
--db-host="localhost:3308" \
--db-name="magento3" \
--db-user="myadmin" \
--db-password="Angular13" \
--admin-firstname="admin" \
--admin-lastname="admin" \
--admin-email="saz3sumar@gmail.com" \
--admin-user="admin" \
--admin-password="Admin123!" \
--language="en_US" \
--currency="USD" \
--timezone="America/Chicago" \
--search-engine=elasticsearch7 \
--elasticsearch-host="localhost" \
--elasticsearch-port=9200 \
--use-rewrites=1

For CMD single line

 

php bin/magento setup:install --base-url="http://magento.local/" --db-host="localhost:3306" --db-name="magento" --db-user="root" --db-password="admin" --admin-firstname="admin" --admin-lastname="admin" --admin-email="saz3sumar@gmail.com" --admin-user="admin" --admin-password="Admin123!" --language="en_US" --currency="USD" --timezone="America/Chicago" --search-engine=elasticsearch7 --elasticsearch-host="localhost" --elasticsearch-port=9200 --use-rewrites=1

9. Post-Installation Commands

Run the following commands to finalize the setup:

php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento indexer:reindex
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f


10. Disable Two-Factor Authentication (Optional)

php bin/magento module:disable Magento_AdminAdobeImsTwoFactorAuth Magento_TwoFactorAuth

 

11. Install Sample Data (Optional)

php bin/magento sampledata:deploy
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:clean
php bin/magento setup:static-content:deploy en_US -f

 

If  category image does not show the run this command

 

php bin/magento catalog:images:resize

Enable Developer Mode:

php bin/magento deploy:mode:set developer

 


12. Elasticsearch Troubleshooting

  1. Disable Disk Threshold Checks:
    curl -X PUT -H "Content-Type: application/json" http://localhost:9200/_cluster/settings -d "{ \"transient\": { \"cluster.routing.allocation.disk.threshold_enabled\": false } }"
  2. Clear Read-Only Blocks:
    curl -X PUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d "{ \"index.blocks.read_only_allow_delete\": null }"

13. Test and Access

Use the admin credentials you set during installation.

 

Leave a Reply

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