php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4575 PHP4 does not load extension modules unless LD_LIBRARY_PATH is set
Submitted: 2000-05-24 14:26 UTC Modified: 2000-06-09 02:50 UTC
From: blien at ozramp dot net dot au Assigned:
Status: Closed Package: Dynamic loading
PHP Version: 4.0.0 Release OS: Linux 2.2.14
Private report: No CVE-ID: None
 [2000-05-24 14:26 UTC] blien at ozramp dot net dot au
PHP4 does not load extension modules unless LD_LIBRARY_PATH is set (even if extension_dir directive is correct). Funny thing is that dl("extension.so"); works fine without LD_LIBRARY_PATH being set., however apache generates these errors:
PHP Fatal error:  Unable to load dynamic library 'pgsql.so' - pgsql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Fatal error:  Unable to load dynamic library 'ldap.so' - ldap.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Fatal error:  Unable to load dynamic library 'pgsql.so' - pgsql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Fatal error:  Unable to load dynamic library 'ldap.so' - ldap.so: cannot open shared object file: No such file or directory in Unknown on line 0

And yes, apache repeats the errors!?
The following is the command used (within .spec to build an rpm, hence the variables).
./configure --prefix=%{_prefix} \
        --with-apxs=%{_prefix}/sbin/apxs \
        --with-config-file-path=/etc/httpd \
        --enable-safe-mode \
        --with-exec-dir=%{_prefix}/bin \
        --with-system-regex \
        --disable-debug \
        --with-zlib \
        --with-gdbm \
        --with-db2 \
        --enable-debugger \
        --enable-magic-quotes \
        --enable-track-vars \
        --enable-sysvsem \
        --enable-sysvshm \
        --enable-track-vars \
        --with-xml \
        --with-ftp

extension_dir	=	/usr/lib/apache/	; directory in which the loadable extensions (modules) reside

hope this helps.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-05-27 11:55 UTC] blien at ozramp dot net dot au
This is just a "me too". phpinfo() shows extension_dir set correctly (actually, I just used the default, unlike blien above) but the pgsql.so module fails to load. (I built it with --with-pgsql=shared).

I fixed things by linking pgsql.so into /usr/lib.
 [2000-05-27 11:57 UTC] blien at ozramp dot net dot au
Sorry - don't know how to change the submitting email address. Mine's peter.hunter@op.org in case someone wants me to try a patch, give more info etc etc etc.
 [2000-06-09 02:50 UTC] zeev at cvs dot php dot net
That's really something PHP can't do much about.  LD_LIBRARY_PATH is something that the dynamic linker uses, and is beyond the control of PHP.  pgsql.so (or whatever module you use) is dependant on other dynamic libraries (most probably the PostgreSQL dynamic libraries), which aren't on ld's search path.  Thus, you get this error

Note that it probably has very little to do with the meaning of extension_dir, which is where PHP looks for its extensions.  If the extensions were linked against other dynamic libraries (which is often the case) - you must ensure that these libraries are on ld's search path (e.g., by adding them to the LD_LIBRARY_PATH environment variable)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 03:01:35 2024 UTC