【问题标题】:PHP Warning: PHP Startup: ????????: Unable to initialize modulePHP 警告:PHP 启动:????????:无法初始化模块
【发布时间】:2010-06-28 08:15:24
【问题描述】:

将php从5.1升级到5.2.10后,php -v时出现如下警告:

    # php -v
    PHP Warning:  PHP Startup: fileinfo: Unable to initialize module
    Module compiled with module API=20050922, debug=0, thread-safety=0
    PHP    compiled with module API=20060613, debug=0, thread-safety=0
    These options need to match
     in Unknown on line 0
    PHP Warning:  PHP Startup: mcrypt: Unable to initialize module
    Module compiled with module API=20050922, debug=0, thread-safety=0
    PHP    compiled with module API=20060613, debug=0, thread-safety=0
    These options need to match
     in Unknown on line 0
    PHP Warning:  PHP Startup: memcache: Unable to initialize module
    Module compiled with module API=20050922, debug=0, thread-safety=0
    PHP    compiled with module API=20060613, debug=0, thread-safety=0
    These options need to match
     in Unknown on line 0
    PHP Warning:  PHP Startup: mhash: Unable to initialize module
    Module compiled with module API=20050922, debug=0, thread-safety=0
    PHP    compiled with module API=20060613, debug=0, thread-safety=0
    These options need to match
     in Unknown on line 0
    PHP Warning:  PHP Startup: mssql: Unable to initialize module
    Module compiled with module API=20050922, debug=0, thread-safety=0
    PHP    compiled with module API=20060613, debug=0, thread-safety=0
    These options need to match
     in Unknown on line 0
    PHP Warning:  PHP Startup: readline: Unable to initialize module
    Module compiled with module API=20050922, debug=0, thread-safety=0
    PHP    compiled with module API=20060613, debug=0, thread-safety=0
    These options need to match
     in Unknown on line 0
    PHP Warning:  PHP Startup: tidy: Unable to initialize module
    Module compiled with module API=20050922, debug=0, thread-safety=0
    PHP    compiled with module API=20060613, debug=0, thread-safety=0
    These options need to match
     in Unknown on line 0
    PHP 5.2.10 (cli) (built: Nov 13 2009 11:24:03)
    Copyright (c) 1997-2009 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

我该如何解决?谢谢!

【问题讨论】:

    标签: php installation


    【解决方案1】:

    看起来您还没有升级 PHP 模块,它们不兼容。

    检查 php.ini 中的 extension_dir 指令。它应该指向带有 5.2 模块的文件夹。

    创建并打开一个phpinfo文件并搜索extension_dir找到路径。

    由于您进行了升级,因此您有可能使用的是指向 5.1 模块的旧 php.ini

    【讨论】:

    • extension_dir 指向/user/lib/php/modules,其中有许多.so 文件。我怎样才能知道那些.so 文件的版本?谢谢
    • 当您像问题一样运行 php 时,对于每个不兼容的模块,您将收到警告消息:无法初始化模块使用模块 API=20050922 编译的模块在您的情况下,不兼容的模块是:fileinfo、mcrypt、 memcache、mhash、mssql、readline 和 tidy,因此请尝试禁用它们,看看有什么不同。
    • @Horace:如果您使用的是类 Unix 主机,请在扩展目录中尝试此操作:strings -f *.so|grep API。每个 .so 中可能有多个“API”字符串,但只能使用 API 版本号
    • @Marc,这行不通,至少在我尝试时它在 OSX 上没有:)
    • @bas:嗯。没有字符串命令? grep 没用?也许 OSX PHP 没有在 .so 文件中包含 API 版本。可能在文件的元数据中(资源分叉、扩展属性,无论现在叫什么)。
    【解决方案2】:

    尝试使用 pecl 命令升级每个模块

    # pecl upgrade fileinfo
    # pecl upgrade memcache
    # pecl upgrade mhash
    # pecl upgrade readline
    

    等等……

    【讨论】:

    • 通过 localhost wamp,我如何在 windows 中升级?
    【解决方案3】:

    brew reinstall php56-mcrypt --build-from-source

    为需要使用相同版本编译的每个模块执行此操作 - 传递 --build-from-source 标志。

    根据您的插件,它可能还需要 PHP 选项。如果是这样,brew reinstall php56 --with-thread-safety

    要查看 php[version] 的所有选项,请运行 brew options php56(将 56 替换为您的版本)

    【讨论】:

      【解决方案4】:

      擦除无法初始化的模块,重新安装。

      【讨论】:

        【解决方案5】:

        这是一个旧线程,但我在尝试解决类似问题时偶然发现了它。

        对我来说,我收到了与 php_wincache.dll 相关的特定错误。我正在 Windows 服务器上将 PHP 从 5.5.38 更新到 5.6.31。出于某种原因,并非所有的 DLL 文件都更新为最新版本。大多数人做到了,但有些人没有。

        因此,如果您遇到与此类似的错误,请确保所有扩展都已就位并更新

        【讨论】:

          【解决方案6】:

          这只是描述为什么我会遇到这个问题,以防有人发现它有帮助。

          我的问题是我已经用自制软件升级了 php,并且在某些时候强制我的配置文件或 bashrc 文件中的变量 PHP_INI_SCAN_DIR 指向旧的 php 版本。删除该行并修复。

          【讨论】:

            【解决方案7】:

            当我尝试安装较新版本的PHP 时,这发生在我身上。在发现我还需要为此重新配置 Apache 后,我切换回旧的 PHP 版本。这是对我有用的解决方案:

            将 httpd.conf 更改为正确的版本:

             PHPIniDir ...
             LoadModule php5_module ...
            

            改了

            PATH - Environment Variable
            

            当这不起作用时

            rename or delete the new PHP(-Version)-Folder
            

            由于某种原因,最后一步对我有用。即使在重新启动后,它在执行此操作之前也没有效果。

            【讨论】:

              【解决方案8】:

              如果您使用自制软件安装 php,请检查您的 apache2.conf 文件是否使用自制软件版本的 php5.so 文件。

              【讨论】:

                【解决方案9】:

                就我而言,对于 Windows Server 2008,我必须更改 PATH 变量。 PHP(VC9)的旧版本就在其中。

                我已用较新版本的 PHP (VC11) 对其进行了更改。

                重启 Apache 后就没事了。

                【讨论】:

                  猜你喜欢
                  • 2015-08-15
                  • 2012-11-28
                  • 1970-01-01
                  • 2014-11-17
                  • 2012-11-11
                  • 1970-01-01
                  • 1970-01-01
                  • 2018-08-24
                  • 2011-02-12
                  相关资源
                  最近更新 更多