Installation of Magento CE 2.3.5 in XAMPP Windows 10

Recently I am accessing on the feature of Magento 2.0 as i have a couple of web store running Mangeto 1.0 and the support for Magento 1.0 is ending soon.

Hence, I am trying to find a quick and dirty way to install Magento CE build to a the trusty all-in-one XAMP. However, it is not a smooth sail to get this done. I decided to write down here in case I need to reference it next time.

What I want to install

  • Magento CE 2.3.5
  • XAMPP 7.3.19
  • Windows 10

And the issues i encountered

Issue 1: Magento does not support PHP 7.4.7 (XAMPP latest installer)

Upon running the Magento setup, there is a ‘Readiness Check’ and it will failed at the PHP version.

Although it is possible to install 2 different php version into a XAMPP, i figured the quickest way is to download and install another XAMPP… which i did.


Issue 2: Execution Timeout

About 120 seconds, the installation shows that it failed.

The magento installation took more than 120 seconds and 120 seconds is the default setting of the max execution timeout that came with XAMPP.

This ca be easily changing the following variables under php.ini

max_execution_time = 12000

And luckily it doesn’t take more than 1200 seconds.


Issue 3: Installation Stuck at 51%

Seemed like I am not the only one who stuck at 51% no matter how many times i tried.

It seemed that the GD2 adapter has issue with checking ‘URL’ format.

Under

vendor\magento\framework\Image\Adapter\Gd2.php

Change the whole function to the following codes

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;
  }

Issue 4: Blank Shop Frontend Page. Blank Admin page

Did a couple of google, below are the things I did to get it running. Apparently Magento seemed not able to generate the frontend files correctly due to the froward and backslash thingy between linux and windows,

Under

\vendor\magento\framework\View\Element\Template\File\Validator.php

Change

public function isValid($filename)
    {
        $filename = str_replace('\\', '/', $filename);
        if (!isset($this->_templatesValidationResults[$filename])) {
            $this->_templatesValidationResults[$filename] =
                ($this->isPathInDirectories($filename, $this->_compiledDir)
                    || $this->isPathInDirectories($filename, $this->moduleDirs)
                    || $this->isPathInDirectories($filename, $this->_themesDir)
                    || $this->_isAllowSymlinks)
                && $this->getRootDirectory()->isFile($this->getRootDirectory()->getRelativePath($filename));
        }
        return $this->_templatesValidationResults[$filename];
       
    }

to

public function isValid($filename)
{
        return true;
}


Issue 5: Admin able show login textbox but not image and jquery files are still broken

After few googles, realized that this is probably due to the caching where Magento will keep caching to some ‘versionXXXXX’ folder. The workaround is to fix it to write to pub/static and not jumping around.

Under

pub/static/.htaccess 

Update the mod rewrite codes to the following

<IfModule mod_rewrite.c>
    RewriteEngine On

    ## you can put here your pub/static folder path relative to web root
    RewriteBase /pub/static/

    # Remove signature of the static files that is used to overcome the browser cache
    RewriteRule ^version.+?/(.+)$ $1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-l

    RewriteRule .* ../static.php?resource=$0 [L]
    # Detects if moxieplayer request with uri params and redirects to uri without params
    <Files moxieplayer.swf>
     	RewriteCond %{QUERY_STRING} !^$
     	RewriteRule ^(.*)$ %{REQUEST_URI}? [R=301,L]
     </Files>
</IfModule>    

and under command prompt, clear all caches

G:\xampp\php>php G:\sandbox\magento2\bin\magento cache:clean

and regenerate the content files.

G:\xampp\php>php G:\sandbox\magento2\bin\magento setup:static-content:deploy -f

That’s it. LUMA finally get it started and backend admin works.

Related posts

Delete files FAST in Linux

Magento – Get the list of products which customer wanted to be notify when it is back in stock

catalog_product index does not exist yet. Make sure everything is reindexed.