Magento编译器 - 命令行 [英] Magento compiler - command line
问题描述
当我通过命令行在
我的存储的根中单击shell文件夹中的编译器状态时,它返回,编译器被启用,如在admin,但是当我检查在根文件夹的我的Magento网站是返回状态已禁用!
$ / var / www / magento#php shell / compiler.php state
编译器状态:已禁用
编译状态:编译
收集的文件数:6764
编译范围计数:4
$ / var / www / magento#cd shell /
$ / var / www / magento / shell#php compiler.php state
编译器状态:启用
编译状态:编译
收集的文件数:6764
编译范围计数:4
虽然我试图通过关闭编译器模式,重新编译,然后重新打开来解决这个问题,我得到相同的结果! / p>
这个按设计原理(除了设计不好)。下面是确定状态的 compile.php
的代码位。
$ compilerConfig ='../includes/config.php';
if(file_exists($ compilerConfig)){
include $ compilerConfig;
}
$ status = defined('COMPILER_INCLUDE_PATH')? 'Enabled':'Disabled';
键行 $ compilerConfig ='../includes/config。 php';
。此路径从当前目录中向上一个目录,以查找 config.php
。 PHP shell脚本的工作目录是从调用的,而不是它所在的工作目录。所以你说
$ / var / www / magento#php shell / compiler.php state
脚本在
中查找文件/ var / www / magento /../ includes / config.php
或
var / www / includes / config.php
因为它没有找到一个,的残疾人。
When I click the compiler status inside the "shell" folder by command line in the root of my store, it returns that the compiler is enabled so as in admin, however when I check that in the root folder of my Magento site is return the status is disabled !
$/var/www/magento# php shell/compiler.php state Compiler Status: Disabled Compilation State: Compiled Collected Files Count: 6764 Compiled Scopes Count: 4 $/var/www/magento# cd shell/ $/var/www/magento/shell# php compiler.php state Compiler Status: Enabled Compilation State: Compiled Collected Files Count: 6764 Compiled Scopes Count: 4Although I try to fix this by turning compiler mode off, recompiling, and then turning it back on, I get the same result!
解决方案This "works as designed" (except it's just poorly designed). Here's the bit of code from
compiler.php
that determines status.$compilerConfig = '../includes/config.php'; if (file_exists($compilerConfig)) { include $compilerConfig; } $status = defined('COMPILER_INCLUDE_PATH') ? 'Enabled' : 'Disabl ed';
the key line is
$compilerConfig = '../includes/config.php';
. This path goes up one directory from the current directory to findconfig.php
. A PHP shell script's working directory is the one it's invoked from, not the one it lives in. So you you say$/var/www/magento# php shell/compiler.php state
the script looks for a file in
/var/www/magento/../includes/config.php
or
/var/www/includes/config.php
since it doesn't find one, it assumes a state of disabled.
这篇关于Magento编译器 - 命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!