4

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)

hakre
  • 193,403
  • 52
  • 435
  • 836
Reem
  • 1,439
  • 2
  • 18
  • 21

1 Answers1

0

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

0x6A75616E
  • 4,696
  • 2
  • 33
  • 57