PHP警告:PHP启动:????????:无法初始化模块

ohh*_*hho 15 php installation

在将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
Run Code Online (Sandbox Code Playgroud)

我该如何解决?谢谢!

bas*_*bas 17

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

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

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


小智 12

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

# pecl upgrade fileinfo
# pecl upgrade memcache
# pecl upgrade mhash
# pecl upgrade readline
Run Code Online (Sandbox Code Playgroud)

等等...


小智 10

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

这样做--build-from-source- 为每个需要使用相同版本编译的模块传递标志.

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

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