本文介绍了在运行PHP bin/magento deploy:mode:set production时,我在magento 2.1上遇到错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在nginx上使用php7

I am using php7 with nginx

编译生成的代码时出错.有关详细信息,请参见错误日志.

Something went wrong while compiling generated code. See the error log for details.

推荐答案

尝试使用-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

这篇关于在运行PHP bin/magento deploy:mode:set production时,我在magento 2.1上遇到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 15:09