重新编译 php 后出现警告(无法加载动态库和无法初始化模块)

发布于 2024-10-19 22:27:32 字数 2404 浏览 4 评论 0原文

重新编译 php 后,当我使用 php cli 时,出现以下错误:

PHP Warning:  PHP Startup: imap: Unable to initialize module
Module compiled with module API=20050922
PHP    compiled with module API=20090626
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/ldap.so' - /usr/lib/php/modules/ldap.so: undefined symbol: third_arg_force_ref in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mbstring.so' - /usr/lib/php/modules/mbstring.so: undefined symbol: second_arg_force_ref in Unknown on line 0
PHP Warning:  PHP Startup: mysql: Unable to initialize module
Module compiled with module API=20050922
PHP    compiled with module API=20090626
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: mysqli: Unable to initialize module
Module compiled with module API=20050922
PHP    compiled with module API=20090626
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: PDO: Unable to initialize module
Module compiled with module API=20050922
PHP    compiled with module API=20090626
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: pdo_mysql: Unable to initialize module
Module compiled with module API=20050922
PHP    compiled with module API=20090626
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: pdo_sqlite: Unable to initialize module
Module compiled with module API=20050922
PHP    compiled with module API=20090626
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mapi.so' - /usr/lib/php/modules/mapi.so: undefined symbol: fourth_arg_force_ref in Unknown on line 0

经过一番谷歌搜索后,我发现模块必须更新,我尝试过:

pecl install <modulename>

并且

pecl upgrade <modulename>

但是

pear install -f pecl/<modulename>

我得到了如下错误:

configure: error: mysql_query missing!?
ERROR: `/tmp/pear/temp/PDO_MYSQL/configure' failed

或者错误如下:

make: *** [sqlite_driver.lo] 
Error 1 ERROR: `make' failed

知道如何更新模块吗?

如果在编译之前我应该​​做些什么,请向我解释一下,因为我要在其他服务器上重新编译 php,并且我想在再次遇到同样的问题之前知道解决方案。

提前致谢。

PS:我的操作系统是Linux(Redhat)

After recompiling php I get the following errors when I use php cli:

PHP Warning:  PHP Startup: imap: Unable to initialize module
Module compiled with module API=20050922
PHP    compiled with module API=20090626
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/ldap.so' - /usr/lib/php/modules/ldap.so: undefined symbol: third_arg_force_ref in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mbstring.so' - /usr/lib/php/modules/mbstring.so: undefined symbol: second_arg_force_ref in Unknown on line 0
PHP Warning:  PHP Startup: mysql: Unable to initialize module
Module compiled with module API=20050922
PHP    compiled with module API=20090626
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: mysqli: Unable to initialize module
Module compiled with module API=20050922
PHP    compiled with module API=20090626
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: PDO: Unable to initialize module
Module compiled with module API=20050922
PHP    compiled with module API=20090626
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: pdo_mysql: Unable to initialize module
Module compiled with module API=20050922
PHP    compiled with module API=20090626
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: pdo_sqlite: Unable to initialize module
Module compiled with module API=20050922
PHP    compiled with module API=20090626
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mapi.so' - /usr/lib/php/modules/mapi.so: undefined symbol: fourth_arg_force_ref in Unknown on line 0

After some googling I found that the modules have to be updated, I tried:

pecl install <modulename>

and

pecl upgrade <modulename>

and

pear install -f pecl/<modulename>

but I got errors like:

configure: error: mysql_query missing!?
ERROR: `/tmp/pear/temp/PDO_MYSQL/configure' failed

Or errors like:

make: *** [sqlite_driver.lo] 
Error 1 ERROR: `make' failed

Any idea how to update the modules?

If there was anything that I should have done before compiling please explain to me because I'm going to recompile php on other servers and I want to know the solution before I face the same problem again.

Thanks in advance.

PS: My OS is Linux (Redhat)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撩动你心 2024-10-26 22:27:32

看来您遇到的问题是您的 php 和模块 API 不同,例如:

Module compiled with module API=20050922     <----- this
PHP    compiled with module API=20090626     <----- and this should match.

我通常通过从源代码编译扩展来安装扩展,这似乎工作更可靠。

您需要使用 phpize

作为示例,以下是我的方法d 安装 APC:

wget http://pecl.php.net/get/APC-3.1.9.tgz
tar -xvzf APC-3.1.9.tgz
cd APC-3.1.9
phpize
./configure
make
sudo make install

这应该适用于所有 PECL 扩展。现在,您还有其他错误..我建议检查您的 php.ini 并首先禁用所有扩展 - 然后逐一启用并修复。

还有一个关于 mysqli 的错误。如果您使用 php >= 5.0.0,那么您需要重新编译 php(使用 ./configure [....] --with-mysqli),否则上面的过程应该适用于它出色地。

华泰

It looks like the problem you're having is that your php and module APIs are different, e.g.:

Module compiled with module API=20050922     <----- this
PHP    compiled with module API=20090626     <----- and this should match.

I usually install extensions by compiling them from source, which seems to work a lot more reliably.

You'll need to use phpize

As an example, here's how I'd install APC:

wget http://pecl.php.net/get/APC-3.1.9.tgz
tar -xvzf APC-3.1.9.tgz
cd APC-3.1.9
phpize
./configure
make
sudo make install

This should work for all PECL extensions. Now, you also have other errors.. I would suggest going through your php.ini and disabling all extensions at first - then enable and fix one by one.

There's also an error about mysqli. If you're using php >= 5.0.0, then you'll need to re-compile php (with ./configure [....] --with-mysqli), otherwise the procedure above should work for it as well.

HTH

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文