1

I'm new to posting on this forum. Hopefully I don't make any social mistakes here.

I have:

  1. Linux system (64 bit)
  2. php compiled and installed with the following options:

./configure --enable-maintainer-zts --with-pdo-mysql --with-mysqli=mysqlnd --prefix=/etc/httpd/php --with-gd --with-config-file-path=/etc/httpd/php --disable-cgi --with-zlib --with-gettext --with-gdbm --enable-zip --enable-mbstring --with-zlib-dir=/usr/include --with-libxml-dir=/usr/lib64 --with-mcrypt=/usr/lib64 --with-jpeg-dir=/usr --with-png-dir=/usr --with-apxs2=/etc/httpd/bin/apxs --enable-shared


  1. php.ini with the following settings:
extension_dir = "/usr/lib64/php/modules/"

extension=mongo.so
extension=curl.so
extension=json.so
extension=fileinfo.so
extension=gd.so
extension=mbstring.so
extension=mcrypt.so
extension=phar.so
extension=zip.so

  1. ls -l /usr/lib64/php/modules =

curl.so fileinfo.so gd.so json.so mbstring.so mcrypt.so mongo.so phar.so zip.so


  1. A hello world PHP App print_something.php with the following line:
<?php
echo "Hello world\n";
?>
  1. php version is 5.6.0

  2. when run at the command line with:

    php print_something.php

I get the following output:

php print_something.php

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mongo.so' - /usr/lib64/php/modules/mongo.so: undefined symbol: file_globals in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/curl.so' - /usr/lib64/php/modules/curl.so: undefined symbol: file_globals in Unknown on line 0 PHP Warning:

PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/json.so' - >/usr/lib64/php/modules/json.so: undefined symbol: executor_globals in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/fileinfo.so' - /usr/lib64/php/modules/fileinfo.so: undefined symbol: file_globals in Unknown on l line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/gd.so' - /usr/lib64/php/modules/gd.so: undefined symbol: core_globals in Unknown on line 0

PHP Warning: PHP > Startup: Unable to load dynamic library '/usr/lib64/php/modules/mbstring.so' - /usr/lib64/php/modules/mbstring.so: undefined symbol: sapi_globals in Unknown on l line 0

PHP Warning: PHP Startup: mcrypt: Unable to initialize module Module compiled with module API=20090626 PHP compiled with module API=20131226 These options need to match in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/phar.so' - /usr/lib64/php/modules/phar.so: undefined symbol: sapi_globals in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/zip.so' - /usr/lib64/php/modules/zip.so: undefined symbol: executor_globals in Unknown on line 0

Hello world


What I really need is mongo.so (I added the others just to make sure it wasn't a mongo issue alone). I've looked both general and specific searches on php shared modules not loading, and cannot find any answers on how to resolve this. If anyone can shed light on why these modules will not load, it would be really appreciated.

Markus W Mahlberg
  • 19,711
  • 6
  • 65
  • 89
John Gunter
  • 11
  • 1
  • 1
  • 3

1 Answers1

4

The PHP extensions are not compiled for this version of your PHP.

Same for missing symbols, because not linked against the correct PHP version.

Example from your errors: mcrypt

  • Module compiled with module API=20090626
  • PHP compiled with module API=20131226
  • These options need to match

Solution: Update the PHP extensions using your package management system to be in sync with PHP or compile them manually using PHP, the SDK and the extensions you want.

You find the Mongo Extension here: http://pecl.php.net/package/mongo

Jens A. Koch
  • 39,862
  • 13
  • 113
  • 141
  • 2
    Thanks! Although I still had to search to find exactly what I needed to do, this was a great clue! Here was my solution: I needed to recompile mongo.so with the following argument added to my configure: ./configure --with-php-config=/usr/local/src/php/scripts/php-config (/usr/local/src/php is where my php source code is compiled) I also had to chmod +x /usr/local/src/php/scripts/php-config so .configure could find the script. When I did a make install, it placed mongo.so in a different directory (not /usr/lib64/php/modules) ... So I needed to edit php.ini extension_dir. Restarted httpd! – John Gunter Sep 27 '14 at 06:05
  • 1
    @JohnGunter very good information! Before executing `./configure`, one should also use `/usr/local/src/php/scripts/phpize` to build the correct versions and API strings – Daniel W. Feb 11 '15 at 20:55