且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在运行PHP bin/magento deploy:mode:set production时,我在magento 2.1上遇到错误

更新时间:2023-02-22 19:53:29

尝试使用-vvv开关运行失败的命令(非常详细的输出).

try to run the failing command with the -vvv switch (for very verbose output).

/usr/bin/php7.0 -f /var/www/magento2/bin/magento setup:di:compile -vvv

使用此命令,您至少应该获得比发生错误..."更好的错误消息.

with this command you should at least get a better error message than "an error occurred..."

很有可能,只是memory_limit太低了.您可以通过在php命令中添加-d参数来增加php进程的内存限制:

very likely, it's just the memory_limit being too low. You can increase the memory limit for a php process by adding the -d parameter to the php command:

/usr/bin/php7.0 -d memory_limit=1G -f /var/www/magento2/bin/magento setup:di:compile

如果运行deploy:mode:set production,编译将作为子进程开始,并且您不能像这样增加内存限制(因为未将参数传递给子命令)

if you run deploy:mode:set production, the compilation will be startet as a sub process and you can't increase the memory limit like this (since the parameter is not passed to the sub command)

在这种情况下,您必须增加php配置中的内存限制

in this case, you have to increase the memory limit in your php configuration