Typo3 crashed after installing extension: Parse error: syntax error

Typo3 crashed after installing extension: Parse error: syntax error

我是 运行 Typo3 7.6 并且愚蠢地在我的网站上尝试了一个过时的扩展。我遇到了一个错误,试图卸载扩展程序,但这让事情变得更糟。现在整个系统都崩溃了,出现了这个错误:

Parse error: syntax error, unexpected '=' in /html/typo3/typo3_src-7.6.10/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php on line 1654

不确定它要我用这些信息做什么。

这是我在第 1654 行 ExtensionManagementUtility.php 中的代码:

    /**
 * Execute ext_localconf.php files from extensions
 *
 * @return void
 */
protected static function loadSingleExtLocalconfFiles()
{
    // This is the main array meant to be manipulated in the ext_localconf.php files
    // In general it is recommended to not rely on it to be globally defined in that
    // scope but to use $GLOBALS['TYPO3_CONF_VARS'] instead.
    // Nevertheless we define it here as global for backwards compatibility.
    global $TYPO3_CONF_VARS;
    foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $_EXTKEY => $extensionInformation) {
        if ((is_array($extensionInformation) || $extensionInformation instanceof \ArrayAccess) && isset($extensionInformation['ext_localconf.php'])) {
            // $_EXTKEY and $_EXTCONF are available in ext_localconf.php
            // and are explicitly set in cached file as well
            $_EXTCONF = isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY]) ? $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY] : null;
            require $extensionInformation['ext_localconf.php'];
        }
    }
}

我该如何摆脱困境?

这个问题似乎来自其中一个包含的文件,即您的一个扩展的配置。我不明白为什么 PHP 不显示实际的文件名,但是好吧......让我们尝试修复它:

获取文件名,在require…前插入一行输出:

echo $_EXTKEY, " ", $extensionInformation['ext_localconf.php'], "\n";
require $extensionInformation['ext_localconf.php'];

重新加载后,您应该会看到一个扩展键和文件名列表,最后一个是导致问题的那个。

如果您只想恢复安装,则需要停用该新扩展。

您可以尝试在安装工具中执行此操作(只需调用您的域。tld/typo3/install/):在区域 "Important Actions" 中,您可以找到选项 检查损坏的扩展程序

或者您手动执行:编辑 typo3conf/PackageStates.php,搜索该扩展并将状态从 active 更改为 inactive。然后清除所有缓存!

之后您可以删除扩展程序。