Apache“无法初始化模块"因为更改 PHP 配置后模块和 PHP 的 API 不匹配 [英] Apache is "Unable to initialize module" because of module's and PHP's API don't match after changing the PHP configuration

查看:22
本文介绍了Apache“无法初始化模块"因为更改 PHP 配置后模块和 PHP 的 API 不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

php -v 给出这个

PHP 警告:PHP 启动:memcache:无法初始化模块使用模块 API=20060613 编译的模块使用模块 API=20090626 编译的 PHP这些选项需要在第 0 行的 Unknown 中匹配PHP 警告:PHP 启动:memcache:无法初始化模块使用模块 API=20060613 编译的模块使用模块 API=20090626 编译的 PHP这些选项需要在第 0 行的 Unknown 中匹配假测试名称测试/

ps.我已经从 php 5.2 升级到 5.3.在此之前一切正常.

解决方案

当您更新 PHP 版本(尤其是从 XY 版本到 XZ 版本时)您必须更新 PHPPHP 扩展程序.


这是因为 PHP 扩展是用 C 开发的,并且与 PHP 的内部接近"——这意味着,如果这些内部的 API 发生变化,则必须重新编译扩展,以使用新版本.

而且,在 PHP 5.2 和 PHP 5.3 之间,据我所知,PHP 引擎使用的内部数据结构发生了一些修改——这意味着必须重新编译扩展,以匹配新的这些数据结构的版本.


如何更新 PHP 扩展取决于您使用的系统.

如果您使用的是 Windows,您可以在此处找到某些扩展的 .dll:http://downloads.php.net/pierre/
有关不同版本的更多信息,您可以查看windows.php 左侧栏的说明.net.

如果您使用的是 Linux,则必须:

  • 检查您的发行版提供了什么
  • 或者使用 pecl 命令,重新下载相关扩展的源代码,并重新编译它们.

php -v gives this

PHP Warning:  PHP Startup: memcache: Unable to initialize module
Module compiled with module API=20060613
PHP    compiled with module API=20090626
These options need to match in Unknown on line 0
PHP Warning:  PHP Startup: memcache: Unable to initialize module
Module compiled with module API=20060613
PHP    compiled with module API=20090626
These options need to match in Unknown on line 0
bogus test name tests/

ps. i've upgraded from php 5.2 to 5.3. before this everything worked okay.

解决方案

When you update the version of PHP (especially when going from version X.Y to version X.Z), you must update the PHP extensions as well.


This is because PHP extensions are developped in C, and are "close" to the internals of PHP -- which means that, if the APIs of those internals change, the extension must be re-compiled, to use the new versions.

And, between PHP 5.2 and PHP 5.3, for what I remember, there have been some modifications in the internal data-structures used by the PHP engine -- which means extensions must be re-compiled, in order to match that new version of those data-structures.


How to update your PHP extensions will depend on which system you are using.

If you are on windows, you can find the .dll for some extensions here : http://downloads.php.net/pierre/
For more informations about the different versions, you can take a look at what's said on the left-sidebar of windows.php.net.

If you are on Linux, you must either :

  • Check what your distribution provides
  • Or use the pecl command, to re-download the sources of the extensions in question, and re-compile them.

这篇关于Apache“无法初始化模块"因为更改 PHP 配置后模块和 PHP 的 API 不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆