
If you ever tried to get magento to work on a windows environment you know how painful it is. Just writing this to keep a note as i am sure i will forget the steps soon
Opensource version available on github
https://github.com/magento/magento2/
Composer is required, get dependencies with
composer install
PHP Extensions:
extension=bz2
extension=curl
extension=fileinfo
extension=gd2
extension=gettext
extension=intl
extension=mbstring
extension=exif ; Must be after mbstring as it depends on it
extension=mysqli
extension=pdo_mysql
extension=pdo_sqlite
extension=soap
extension=sockets
extension=xsl
Default database required as name “magento2” create that first
Command prompt into htdocs\<magento_root>\bin there should be a file named “magento”, assuming php.exe is globally accessible the commands are executable from here.
First need to disable ElasticSearch
php.exe magento module:disable Magento_Elasticsearch6
php.exe magento module:disable Magento_Elasticsearch7
php.exe magento module:disable Magento_Elasticsearch
htdocs\<magento_root>\lib\internal\Magento\Framework\Image\Adapter\GD2.php
Replace the function validateURLScheme with this, old code is there under /**/
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;
/*$allowed_schemes = ['ftp', 'ftps', 'http', 'https'];
$url = parse_url($filename);
if ($url && isset($url['scheme']) && !in_array($url['scheme'],
$allowed_schemes)) {
return false;
}
return true;*/
}
htdocs\<magento_root>\lib\internal\Magento\Framework\View\Element\Template\File\Validator.php
replace isPathInDirectories function with. (old code in comment)
protected function isPathInDirectories($path, $directories)
{
if (!is_array($directories)) {
$directories = (array)$directories;
}
$realPath = $this->fileDriver->getRealPath($path);
foreach ($directories as $directory) {
$realDirectory = $this->fileDriver->getRealPath($directory);
if ($realDirectory && 0 === strpos($realPath, $realDirectory)) {
return true;
}
/*if (0 === strpos($realPath, $directory)) {
return true;
}*/
}
return false;
}
finally possible to run setup. Command prompt into htdocs\<magento_root>\bin
php.exe magento setup:install
to create first admin user
php.exe magento admin:user:create