2010-06-28 253 views
13

从5.1升级到PHP 5.2.10后,我得到了以下警告时php -vPHP的警告:PHP启动:????????:无法初始化模块

# 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 

我怎样才能修理它?谢谢!

回答

15

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

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

既然你没有升级,还有就是你使用的是使用PECL命令

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

等指向5.1模块

+0

'extension_dir'指向'/ user/lib/php/modules',其中有许多'.so'文件。我怎么能告诉这些'.so'文件的版本? THX – ohho 2010-06-28 09:08:00

+0

当你为你的问题做了运行PHP,每个不兼容的模块,您将收到警告消息: 无法初始化模块,模块与模块API编译= 20050922 你的情况不兼容的模块有:FileInfo的,mcrypt的,内存缓存, mhash,mssql,readline和tidy,所以尝试禁用它们,看看它是否有所作为。 – bas 2010-06-28 20:54:51

+0

@Horace:如果您使用的是类Unix的主机,请在扩展名dir:'strings -f * .so | grep API'中尝试此操作。每个.so文件中可能会有多个'API'字符串,但只能在API版本号 – 2010-06-28 21:06:17

10

尝试升级每个这些模块的老的php.ini机会..

+0

2017,仍然在工作!谢谢 – funilrys 2017-02-07 12:32:47

1

清除无法初始化的模块并重新安装。

10

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

做这个,通过--build-from-source标志,为此需要使用相同版本的编译每个模块。

它可能还需要PHP选项,具体取决于您的插件。如果是这样,brew reinstall php56 --with-thread-safety

要查看所有的选项PHP [版]运行brew options php56(与你的版本替换56)

0

这只是说明我为什么有这个问题的情况下,有人认为它有用。

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

0

当我试图安装PHP的较新版本时,发生了这种情况。在发现我还需要重新配置Apache以便我切换回旧的PHP版本。下面这为我工作的解决方案:

变化httpd.conf中正确的版本:

PHPIniDir ... 
LoadModule php5_module ... 

改变了

PATH - Environment Variable 

如果不采取任何影响

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

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

0

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

0

就我而言,在Windows Server 2008中,我必须更改PATH变量。 PHP的前一版本(VC9)在里面。

我用较新版本的PHP(VC11)更改了它。

重新启动Apache后,它没问题。

0

这是一个古老的线程,但我试图解决类似的问题时偶然发现了它。

对我来说,我得到了这个与php_wincache.dll有关的特定错误。我正在Windows服务器上将PHP从5.5.38更新到5.6.31。由于某些原因,并非所有DLL文件都使用最新版本进行更新。大部分都做了,但有些没有。

所以,如果你得到一个类似的错误,确保所有的扩展到位和更新

相关问题