how to install magento 2.4.1 in localhost

cpujjwal

Member
XNullUser
Joined
Feb 3, 2022
Messages
32
Reaction score
3
Points
8
NullCash
1
nstall Magento 2.4.1 on Windows 10 using Composer and Command line Localhost XAMPP
Ok, Let's go...

1. Download Install XAMPP and Composer

2. Install Elasticsearch & run and test
Ok


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

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:

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:

php bin/magento setup:install --base-url="http://localhost/magento2.4" --db-host="localhost" --db-name="magento2.4" --db-user="root" --db-password="" --admin-firstname="admin" --admin-lastname="admin" --admin-email="user@example.com" --admin-user="admin" --admin-password="admin@123" --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

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 138 replace code with this one

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

//use this code if above is not working Find file Validator.php in ...Magento\Framework\View\Element\Template\File
At around line 138 replace code with this one
$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));

Run : php bin/magento cache:flush


php bin/magento module:disable Magento_TwoFactorAuth
 

zyhivan

Member
XNullUser
Joined
Aug 6, 2021
Messages
790
Reaction score
0
Points
16
NullCash
3,710
Thanks for sharing it, Thank you so much! Thank you so much!
 
Top