记录一下xampp + windows10 +magento2.3.5本地环境不工作

2.43K 浏览开发笔记问题

记录一下xampp + windows10 +magento2.3.5本地环境不工作

1 php bin/magento deploy:mode:show
PHP Warning: PHP Startup: Unable to load dynamic library 'php_mcrypt.dll'

提示找不到php.mcrypt.dll
https://windows.php.net/downloads/pecl/releases/mcrypt/1.0.3/
下载对应的dll文件 php_mcrypt.dll
解压复制粘贴到C:\xampp\php\ext

2 php bin/magento deploy:mode:show 现在正常工作显示
Current application mode: default. (Note: Environment variables may override this value.)

3 php bin/magento deploy:mode:set developer
Enabled developer mode.

4 前台依旧报错
1 exception(s):
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'C:/xampp/htdocs/magento2.3.5/vendor/magento/module-theme/view/frontend/templates/page/js/require_js.phtml' in module: '' block's name: 'require.js

5 open file /vendor/magento/framework/View/Element/Template/File/Validator.php in magento install dir , find
$realPath = $this->fileDriver->getRealPath($path);
replace with :
$realPath = str_replace('', '/', $this->fileDriver->getRealPath($path));

open file app/etc/di.xml in magento install dir, find

Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink

and replace with

Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

6 done 解决

安装 Magento 卡在了 51% 的地方,报错信息如下:
odule 'Magento_Theme':
[ERROR] InvalidArgumentException: Wrong file in magento2\vendor\magento\framework\Image\Adapter\Gd2.php:64 Stack trace:
修改 vendor\magento\framework\Image\Adapter\Gd2.php 中的 validateURLScheme 方法中的部分代码为
if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes) && !file_exists($filename)) {
return false;
}

1