带有错误编译 API 的 PHP 模块(无法初始化)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8406743/
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-26 04:37:23  来源:igfitidea点击:

PHP Module with incorrect compiled API (unable to initialize)

phpsql-server

提问by Andrew Vogel

I'm trying to install freetds and php-mssql on a RHEL5 box. I've successfully done (what appears to be) everything. However, I get the following error when PHP attempts to load the module:

我正在尝试在 RHEL5 机器上安装 freetds 和 php-mssql。我已经成功地完成了(似乎是)一切。但是,当 PHP 尝试加载模块时出现以下错误:

PHP Warning:  PHP Startup: mssql: Unable to initialize module
Module compiled with module API=20090626, debug=0, thread-safety=0
PHP    compiled with module API=20050922, debug=0, thread-safety=0
These options need to match

I've been pulling my brain out trying to figure out why they are different values, but having no success.

我一直在绞尽脑汁想弄清楚为什么它们是不同的价值观,但没有成功。

In the latest attempt, I downloaded the php source for the version I am running (php-5.3.8), went into the ext/mssql folder and ran phpize, configure, make, make install.

在最近的尝试中,我下载了我正在运行的版本 (php-5.3.8) 的 php 源代码,进入 ext/mssql 文件夹并运行 phpize、configure、make、make install。

I verified the mssql.so file is in the appropriate folder, and that php is trying to load it.

我验证了 mssql.so 文件位于适当的文件夹中,并且 php 正在尝试加载它。

phpize -v
Configuring for:
PHP Api Version:         20050922
Zend Module Api No:      20090626
Zend Extension Api No:   220090626

回答by jap1968

RHEL had an older version of php (5.1.x), and the installation of newer php versions (such as 5.3.x) means several changes. If you install from unofficial repos, you will see packages named php-* and php5-* . Having both versions can be the origin of the problems.

RHEL 的 php 版本较旧(5.1.x),安装较新的 php 版本(如 5.3.x)意味着一些变化。如果您从非官方存储库安装,您将看到名为 php-* 和 php5-* 的包。有两个版本可能是问题的根源。

It looks like your system is accessing some configuration files from previous php installations.

看起来您的系统正在访问以前安装的 php 中的一些配置文件。

Have a look at: - /etc/php.d Be sure you do not have elements from old versions - Have a look at /usr/bin/php-config* , If you have both php-config and php-config5, remove (rename) of /usr/bin/php-config and make a symlink to the new one:

看看: - /etc/php.d 确保你没有旧版本的元素 - 看看 /usr/bin/php-config* ,如果你有 php-config 和 php-config5,删除(重命名) /usr/bin/php-config 并创建一个指向新的符号链接:

# mv /usr/bin/php-config /usr/bin/php-config_old
# ln -s /usr/bin/php-config5 /usr/bin/php-config

Hope this helps

希望这可以帮助

回答by Gigamegs

I can confirm that when a module doesn't load because of a different API it's because of an old php-config. Then you must look in /usr/bin/php-config and overwrite it with a newer version.

我可以确认,当一个模块由于不同的 API 而无法加载时,那是因为旧的 php-config。然后你必须查看 /usr/bin/php-config 并用更新的版本覆盖它。