Look up anything

Look up anything

Install Magento 2.4.1 on Windows 10 using Composer and Command line Localhost XAMPP

install Magento 2.4.1 on Windows 10 using Composer and Command line Localhost XAMPP
Ok, Let’s go…

1. Download Install XAMPP and Composer Download

2. Install Elasticsearch Download & run and test
Ok

E:\xampp\htdocs\elasticsearch\bin\elasticsearch.bat

http://localhost:9200/
do not turn off elasticsearch

3.Download Magento 2.4 from magento official site

note on windows:
Find validateURLScheme function in vendor\magento\framework\Image\Adapter\Gd2.php file. at line 86. Replace function with this:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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;
}
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; }
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;
  }

 

 

———————————
Now, Install magento v2.4.1
Command line:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
php bin/magento setup:install --base-url="http://localhost/mage2.4" --db-host="localhost" --db-name="db_mage2.4" --db-user="root" --db-password="" --admin-firstname="admin" --admin-lastname="admin" --admin-email="user@example.com" --admin-user="admin" --admin-password="admin123" --use-rewrites="1" --backend-frontname="admin"
php bin/magento setup:install --base-url="http://localhost/mage2.4" --db-host="localhost" --db-name="db_mage2.4" --db-user="root" --db-password="" --admin-firstname="admin" --admin-lastname="admin" --admin-email="user@example.com" --admin-user="admin" --admin-password="admin123" --use-rewrites="1" --backend-frontname="admin"
php bin/magento setup:install --base-url="http://localhost/mage2.4" --db-host="localhost" --db-name="db_mage2.4" --db-user="root" --db-password="" --admin-firstname="admin" --admin-lastname="admin" --admin-email="user@example.com" --admin-user="admin" --admin-password="admin123" --use-rewrites="1" --backend-frontname="admin"

 

Enable Extesion : intl , soap ,socket ,xls

do not turn off elasticsearch
please waiting install……… 1h, ok

4. Test and see the result

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
php bin/magento indexer:reindex
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
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 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
php bin/magento cache:clean
php bin/magento cache:flush

 

Note: On Xampp Windows

Change Symlink to copy in file di.xml
Find file Validator.php in …Magento\Framework\View\Element\Template\File
At around line 133 replace code with this one

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
protected function isPathInDirectories($path, $directories)
{
$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
if (!is_array($directories)) {
$directories = (array)$directories;
}
foreach ($directories as $directory) {
if (0 === strpos($realPath, $directory)) {
return true;
}
}
return false;
}
protected function isPathInDirectories($path, $directories) { $realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path)); if (!is_array($directories)) { $directories = (array)$directories; } foreach ($directories as $directory) { if (0 === strpos($realPath, $directory)) { return true; } } return false; }
protected function isPathInDirectories($path, $directories)
{
    $realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
    if (!is_array($directories)) {
        $directories = (array)$directories;
    }
    foreach ($directories as $directory) {
        if (0 === strpos($realPath, $directory)) {
            return true;
        }
    }
    return false;
}

 

 

Run : php bin/magento cache:flush

http://localhost/mage2.4/

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
php bin/magento module:disable Magento_TwoFactorAuth
php bin/magento module:disable Magento_TwoFactorAuth
php bin/magento module:disable Magento_TwoFactorAuth

 

 

Bookmarked Post

Related Posts