How to Install Magento 2.4.7 on Laragon (Windows 11 Guide)

Setting up a local development environment for Magento 2 can often feel like a daunting task, especially on Windows. However, using Laragon makes this process significantly smoother. In this comprehensive guide, we will walk you through the exact steps to install Magento 2.4.7 on Laragon running on Windows 11.

By the end of this tutorial, you will have a fully functional Magento 2.4.7 installation ready for theme development, extension building, or testing.

1. Prerequisites for Magento 2.4.7

Magento 2.4.7 has strict system requirements. To ensure a smooth installation, your local machine must have the following components ready:

  1. OS: Windows 11.
  2. Web Server: Apache (provided by Laragon).
  3. PHP: Version 8.2 or 8.3. (Magento 2.4.7 does not support PHP 8.1 or lower).
  4. Database: MySQL 8.0 or MariaDB 10.6+.
  5. Composer: Version 2.2 or later.
  6. Search Engine (Mandatory): Elasticsearch (7.17+) or OpenSearch (2.5+). Magento 2.4+ will not install without one of these.

2. Download and Install Laragon

Before configuring anything, you need to have the Laragon environment installed on your Windows 11 machine. Laragon is highly recommended for Magento because of its isolated environment and fast performance.

  1. Go to the official Laragon download page.
  2. Download the Laragon Full version (this package includes Apache, Nginx, MySQL, and PHP out of the box).
  3. Run the downloaded .exe file and follow the installation wizard.
  4. Important: Install Laragon directly in the root directory (e.g., C:\laragon) to avoid Windows permission issues later.
  5. Once installed, open the Laragon app and click Start All to verify that Apache and MySQL are running without port conflicts.

3. Configure the Laragon Environment

With Laragon installed, we need to ensure it is running the correct PHP stack for Magento 2.4.7.

3.1 Switch to PHP 8.2 or 8.3 (If needed)

Magento 2.4.7 mandates PHP 8.2+. If your Laragon isn’t running this version by default:

  1. Download the PHP 8.2 (VS16 x64 Non Thread Safe) zip file from windows.php.net.
  2. Extract the zip into C:\laragon\bin\php\.
  3. Right-click the Laragon UI > PHP > Version and select your new php-8.2.x folder.

3.2 Enable Required PHP Extensions

  1. Right-click Laragon UI > PHP > Extensions.
  2. Ensure the following extensions are checked: bcmath, ctype, curl, dom, gd, intl, mbstring, pdo_mysql, soap, sockets, sodium, xsl, and zip.

3.3 Configure php.ini Settings

  1. Right-click Laragon UI > PHP > php.ini.
  2. Search for and update these limits to prevent installation timeouts:
memory_limit = 4G
max_execution_time = 3600

3.4 Downgrade MySQL to 8.0

Newer versions of Laragon come packaged with MySQL 8.4, but Magento 2.4.7 strictly requires MySQL 8.0. Downgrading in Laragon is incredibly simple:

  1. Download the MySQL 8.0.x ZIP Archive from the official MySQL Community Downloads page.
  2. Extract the downloaded file and move the entire folder into C:\laragon\bin\mysql\.
  3. Right-click the Laragon UI > MySQL > Version and select your newly added mysql-8.0.x folder. (Pro Tip: If MySQL fails to start after switching, simply navigate to C:\laragon\data\ and rename the existing mysql folder. Laragon will automatically generate a fresh, compatible data folder for version 8.0).

4. Install and Run Elasticsearch

Magento 2.4+ requires a search engine to install successfully.

  1. Download Elasticsearch 7.17 for Windows from the official Elastic website.
  2. Extract the folder to a simple path, like C:\elasticsearch.
  3. Open a Command Prompt or Laragon Terminal and execute: C:\elasticsearch\bin\elasticsearch.bat
  4. Leave this terminal window open. You can verify it is running by navigating to http://localhost:9200 in your web browser.

5. Create a Database

  1. Click Database in the Laragon UI to open HeidiSQL.
  2. Connect to your local server (usually root with a blank password).
  3. Right-click your connection > Create new > Database.
  4. Name the database magento247 and click OK.

6. Download Magento 2.4.7 via Composer

We will use Composer to fetch the Magento core files.

    1. Click Terminal in the Laragon UI.
    2. Navigate to the Laragon web root: cd C:\laragon\www
    3. Run the Composer command to create your project (replace magento2 with your preferred folder name):
    composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.7-p3 magento2
    

    (Note: You will need your Magento Marketplace Public and Private keys for authentication).

    7. Fix Magento_Theme Error

    To fix Module ‘Magento_Theme’ Error, go to xampp/htdocs/{magento-folder}/vendor/magento/framework/Image/Adapter/Gd2.php and replace the following function with the below code:

    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;
     }
    
    Fix Magento_Theme Error In Magento 2.4.2

     

    8. Install Magento 2.4.7

    Now, we execute the installation script.

    1. In the terminal, move into your new project directory:

    cd magento2
    

    2. Run the installation command:

    php bin/magento setup:install --base-url="http://magento2.test/" --db-host="localhost" --db-name="magento247" --db-user="root" --admin-firstname="admin" --admin-lastname="admin" --admin-email="[email protected]" --admin-user="admin" --admin-password="admin123" --language="en_US" --currency="USD" --timezone="America/Chicago" --use-rewrites="1" --backend-frontname="admin" --search-engine=elasticsearch7 --elasticsearch-host="localhost" --elasticsearch-port=9200
    

    Laragon’s Auto-Virtual Hosts feature will automatically route http://magento2.test to your project folder.

    9. Execute Additional Tweaks After Installed

    Go to app\etc\di.xml, search Symlink and replace with Copy.

    Search Symlink in di.xml
    Replace Symlink with Copy in di.xml

    Next, fix Magento 2 admin blank page. In vendor\magento\framework\View\Element\Template\File\Validator.php, replace line 138 with:

    $realPath = str_replace('\\', '/',$this->fileDriver->getRealPath($path));
    

    Finally, run step by step these commands:

    php bin/magento indexer:reindex
    
    php bin/magento setup:upgrade
    
    php bin/magento setup:di:compile
    

    If you encounter an error related to PluginListGenerator.php while running the di:compile command, please refer to the following article: Fix Failed to Open Stream Error in PluginListGenerator.php in Magento 2.

    php bin/magento setup:static-content:deploy -f
    
    php bin/magento cache:flush
    

    If you have problems with the Admin Page: “Failed to send the message. Please contact the administrator”.

    Two-Factor Authorization Error

    You need to disable the Two-Factor Authorization module using the following command:

    php bin/magento module:disable Magento_AdminAdobeImsTwoFactorAuth Magento_TwoFactorAuth
    

    After fixing TwoFactorAuth, if you log in but the admin login page remains refreshing after clicking Sign In, you can refer to this article: Fix Magento 2 Admin Login Page Reloading Issue on Windows.

    Security Tip: For the best local performance and security, it is highly recommended to set your web server document root to the pub/ directory. You can do this by editing your project’s .conf file in C:\laragon\etc\apache2\alias.

    So we have successfully installed Magento 2.4.7 on localhost. Here are the results:

    Conclusion

    Congratulations! You have successfully learned how to install Magento 2.4.7 on Laragon running Windows 11. By using Laragon instead of XAMPP, you benefit from a faster, more flexible local development environment.

    If you encounter any issues or errors during the installation process, drop a comment below and we will help you troubleshoot!

    5 1 vote
    Article Rating
    Aaron LX

    Aaron LX

    Aaron is a passionate writer, crazy about shopping, eCommerce and trends. Besides his outstanding research skills and a positive mind, Aaron eagerly shares his experience with the readers.

    Leave a Reply or put your Question here

    0 Comments
    Oldest
    Newest Most Voted
    Inline Feedbacks
    View all comments
    0
    Would love your thoughts, please comment.x
    ()
    x