How To Install Magento on WAMP server in Windows

Hi Friends,

After some time I am back again with my Magento learnings to share with everyone. Recently I got a chance to install Magento on a Windows machine, so I thought of using WAMP instead of XAMPP or MAMP just out of curiosity. However, I would assume the steps should be similar for them as well. Below are the steps.

  1. First we need to download WAMP server from this link based on your system configuration.
  2. During installation I got the error for missing “VCRUNTIME140_1.dll” file. Attached screenshot
  3. To fix this we need to install the missing “Download install Visual C++ Redistributable” based on your windows version.
  4. After installation when I tried to start Wamp server I got this error “MSVCR110.dll” missing.
  5. To fix this we would need to install the “Download the Visual C++ Redistributable for Visual Studio 2012 Update 4” based on the windows version we have.
  6. Please note that in Windows we may have to restart the system few times if we try to install or uninstall our wamp server unlike in Mac or Linux where restarting is rare.
  7. After Wamp is working we can download magento from
  8. We can choose the git, archive or composer based on your preference. I used the archive as it was quicker 🙂
  9. As in the recent versions we have to install using the setup:install command. So the first error I got was “Warning: file_put_contents in plugin-list.php and PluginListGenerator.php”
  10. To fix this vendor/magento/framework/Interception/PluginListGenerator.php and change the code
    $cacheId = implode('|', $this->scopePriorityScheme) . "|" . $this->cacheId;
    with this
    $cacheId = implode('-', $this->scopePriorityScheme) . "-" . $this->cacheId;
  11. After that when I ran the install again I got the below error.
    “Unable to apply data patch Magento\Theme\Setup\Patch\Data\RegisterThemes for module Magento_Theme”
  12. To fix this go to vendor/Magento/Framework/Image/Adapter/Gd2.php and change the below code
    if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes))
    if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes) && !file_exists($filename)) {
  13. After that I got the error “Invalid template file”
  14. To fix this I went to the file vendor/magento/framework/view/element/template/file/validator.php and changed the below code
    $filename = str_replace('\', '/', $filename);
    $filename = str_replace('\', '/', $this->fileDriver->getRealPath($filename));
  15. After this I was able to install magento and see the home page and admin page. However I found that after successful installation also it was giving a blank gray page for admin and no JS and images in the frontend.
  16. To fix this I went to this file vendor\magento\framework\View\Element\Template\File\Validator.php and added a line
    $realPath = str_replace('\', '/', $realPath);
    in the function isPathInDirectories() after
    $realPath = $this->fileDriver->getRealPath($path);
    like below
    protected function isPathInDirectories($path, $directories) { if (!is_array($directories)) { $directories = (array)$directories; } $realPath = $this->fileDriver->getRealPath($path); $realPath = str_replace('\', '/', $realPath); // extra code added foreach ($directories as $directory) { if (0 === strpos($realPath, $directory)) { return true; } } return false; }
  17. After this I was able to see the frontend and admin as expected.
  18. However I was not able to login to the admin, so to fix that I followed these steps below.
  19. In /vendor/magento/module-backend/Model/Auth/Session.php comment
    if ($this->getUser()) {
    like this below
    public function processLogin() { // if ($this->getUser()) { $this->regenerateId(); if ($this->_backendUrl->useSecretKey()) { $this->_backendUrl->renewSecretUrls(); } $this->setIsFirstPageAfterLogin(true); $this->setAcl($this->_aclBuilder->getAcl()); $this->setUpdatedAt(time()); // } return $this; }
  20. After this I was able to login, but getting redirected back to the login page again.
  21. To fix this I changed the admin url in app/etc/env.php to admin
  22. And then ran the below commands in the same order
    php bin/magento setup:di:compile
    php bin/magento setup:upgrade
    php bin/magento setup:static-content:deploy -f
    php bin/magento cache:flush
  23. After this all the issues related to magento installation were resolved. And I was able to successfully login into the magento admin and also in the frontend as well.

  24. Hi, I just wanted to update that in the latest PHP version 8.1 we just need to do the same change as in PluginGenerator.php. And for the validator.php we need to the following.
  25. Go to isPathInDirectories() function and change the for each loop as below:
    foreach ($directories as $directory) {
    if ($directory !== null){
    $realDirectory = $this->fileDriver->getRealPath($directory);
    if ($realDirectory && 0 === strpos($realPath, $realDirectory)) {
    return true;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.