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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3130910/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 08:47:19  来源:igfitidea点击:

PHP Warning: PHP Startup: ????????: Unable to initialize module

phpinstallation

提问by ohho

After upgrading php from 5.1 to 5.2.10, I got the following warnings when php -v:

将 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

How can I fix it? Thanks!

我该如何解决?谢谢!

回答by bas

Looks like you haven't upgraded PHP modules, they are not compatible.

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

Check extension_dirdirective in your php.ini. It should point to folder with 5.2 modules.

检查extension_dirphp.ini 中的指令。它应该指向包含 5.2 模块的文件夹。

Create and open a phpinfo file and search for extension_dirto find the path.

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

Since you did upgrade, there is a chance that you are using old php.ini that is pointing to 5.1 modules

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

回答by Murdani Eko

try to upgrade each of those modules using pecl command

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

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

etc...

等等...

回答by Rahman Malik

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

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

Do this—pass the --build-from-sourceflag—for each module which needs to be compiled with the same version.

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

It may also require PHP options depending on your plugins. If so, brew reinstall php56 --with-thread-safety

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

To see all of the options for php[version] run brew options php56(replacing 56 with your version)

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

回答by kirisky

Erase the module that can't be initialized and reinstall it.

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

回答by pcambra

This is just describing why I had this issue in case someone finds it helpful.

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

My problem was that I had upgraded php with homebrew and had forced at some point the variable PHP_INI_SCAN_DIR in my profile or bashrc file so it was pointing to the old php version. Removed that line and fixed.

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

回答by hogan

This happened to me when I tried to install a newer version of PHP. After finding that I also would need to reconfigure Apache for that I switched back to the old PHP version. Here the solution which worked for me:

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

change the httpd.conf to the correct versions:

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

 PHPIniDir ...
 LoadModule php5_module ...

Changed the

改变了

PATH - Environment Variable

When that does not take any effect

当这没有任何效果时

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

For some reason the last step did the trick for me. Even after a restart it did not have an effect before doing this.

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

回答by Pauls Bebris

If you installed php with homebrew, then check if your apache2.conf file is using homebrew version of php5.so file.

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

回答by kmas

In my case, with Windows Server 2008, I had to change the PATHvariable. The former version of PHP (VC9) was inside it.

就我而言,使用 Windows Server 2008,我不得不更改PATH变量。旧版本的 PHP (VC9) 就在里面。

I have changed it with the newer version of PHP (VC11).

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

After a restart of Apache, it was okay.

重启Apache后,一切正常。

回答by cfnerd

This is an old thread, but I stumbled across it when trying to solve a similar problem.

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

For me, I got this particular error relating to the php_wincache.dll. I was in the process of updating PHP from 5.5.38 to 5.6.31 on a Windows server. For some reason, not all of the DLL files updated with the newest versions. Most did, but some didn't.

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

So, if you get an error similar to this, make sure all the extensions are in place and updated.

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