4

重新编译 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)

4

1 回答 1

0

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

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

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

你需要使用phpize

例如,这是我安装 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),否则上面的过程也应该适用.

高温高压

于 2012-12-04T15:35:31.970 回答