Unable to load dynamic library / fresh install

General discussion forum for the Zend Server
Post Reply
seantobin
Posts: 3
Joined: Thu Apr 09, 2009 10:44 pm

Unable to load dynamic library / fresh install

Post by seantobin » Fri May 22, 2009 6:40 pm

I have a fresh install of RHEL 5 and Zend Server 4.0.2 and I'm having some difficulties with some of the extensions. Specifically, the problem I'm having is:

Code: Select all

$ php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/mcrypt.so' - libmcrypt.so.4: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/mhash.so' - libmhash.so.2: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/oci8.so' - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/pdo_oci.so' - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/pdo_pgsql.so' - libpq.so.5: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/pgsql.so' - libpq.so.5: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  Module 'soap' already loaded in Unknown on line 0
PHP 5.2.9 (cli) (built: Apr 10 2009 11:46:57)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    with Zend Extension Manager v5.1, Copyright (c) 2003-2009, by Zend Technologies
    - with Zend Download Server v1.5, Copyright (c) 1998-2009, by Zend Technologies [loaded] [licensed] [disabled]
    - with Zend Data Cache v4.0, Copyright (c) 2004-2009, by Zend Technologies [loaded] [licensed] [disabled]
    - with Zend Utils v1.0, Copyright (c) 2004-2009, by Zend Technologies [loaded] [licensed] [enabled]
    - with Zend Optimizer+ v4.0, Copyright (c) 1999-2009, by Zend Technologies [loaded] [licensed] [disabled]
    - with Zend Monitor v4.0, Copyright (c) 1999-2009, by Zend Technologies [loaded] [licensed] [disabled]
    - with Zend Debugger v5.2, Copyright (c) 1999-2009, by Zend Technologies [loaded] [licensed] [enabled]
    - with Zend Page Cache v4.0, Copyright (c) 2004-2009, by Zend Technologies [loaded] [licensed] [disabled]
The files in /usr/local/zend/lib/php_extensions are:

Code: Select all

$ md5sum *so*
8ed1099cda215d861560b8fc4f23fd87  libbz2.so.1.0
4c202ab0359064e634063c74a8672878  libclntsh.so.11.1
afa74ad4ef181481fec956ba7405e056  libiconv.so.2
50976118996d0f1affeab2b202f11528  libicudata.so.38
7cf25e6e73781676515538a1305f4fd6  libicui18n.so.38
cba22b3b6462e7d7bc9b4f03f89dbd07  libicuio.so.38
08105323b6afda22c1af3a78d2a95b69  libicuuc.so.38
919db289d626712381caba9b7be4cbe8  libmcrypt.so.4
1fb523bc4b50596d32894588daf910d5  libmhash.so.2
eb7599d75461cdf91619d49689bcb5d0  libnnz11.so
69cdc4a972664735fde04178d5a7db70  libociicus.so
09b89ed749c03ac8144cab46ccdcdb6a  libpq.so.5
85d710cbd2d21aff374fcfbe34850dc6  ZendExtensionManager.so

jess04
Posts: 628
Joined: Thu Jan 15, 2009 3:37 pm

Re: Unable to load dynamic library / fresh install

Post by jess04 » Fri May 22, 2009 7:16 pm

Hello,
/usr/local/zend/lib needs to be included in the LD_LIBRARY_PATH ENV var, you can use:
# . /etc/zce.rc
This will source the /etc/zce.rc file which includes proper exporting on LD_LIBRARY_PATH.
You can place this command in /etc/profile or ~/.bashrc depending on whether you want this export for all users or just yourself.

Let me know if you need further assistance,
May the source be with you,

Jess Portnoy

shaneo
Posts: 36
Joined: Wed Feb 18, 2009 8:02 pm

Re: Unable to load dynamic library / fresh install

Post by shaneo » Wed Nov 25, 2009 5:02 pm

I have this same problem running ZSCE 4.0.6 on Mac OS X (10.5.8)

Code: Select all

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/mcrypt.so' - dlopen(/usr/local/zend/lib/php_extensions/mcrypt.so, 9): Library not loaded: /usr/lib/libltdl.3.dylib
  Referenced from: /usr/local/zend/lib/php_extensions/mcrypt.so
  Reason: image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/oci8.so' - dlopen(/usr/local/zend/lib/php_extensions/oci8.so, 9): Library not loaded: /scratch/plebld/208/rdbms/lib/libclntsh.dylib.10.1
  Referenced from: /usr/local/zend/lib/php_extensions/oci8.so
  Reason: image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/pdo_oci.so' - dlopen(/usr/local/zend/lib/php_extensions/pdo_oci.so, 9): Library not loaded: /scratch/plebld/208/rdbms/lib/libclntsh.dylib.10.1
  Referenced from: /usr/local/zend/lib/php_extensions/pdo_oci.so
  Reason: image not found in Unknown on line 0
PHP 5.3.0 (cli) (built: Nov  8 2009 15:45:42) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
    with Zend Extension Manager v5.1, Copyright (c) 2003-2009, by Zend Technologies
    - with Zend Data Cache v4.0, Copyright (c) 2004-2009, by Zend Technologies [loaded] [licensed] [disabled]
    - with Zend Utils v1.0, Copyright (c) 2004-2009, by Zend Technologies [loaded] [licensed] [enabled]
    - with Zend Optimizer+ v4.0, Copyright (c) 1999-2009, by Zend Technologies [loaded] [licensed] [disabled]
    - with Zend Debugger v5.2, Copyright (c) 1999-2009, by Zend Technologies [loaded] [licensed] [enabled]



LD_LIBRARY_PATH is correctly set in /etc/profile

Code: Select all

iMac:shane$ echo $LD_LIBRARY_PATH
/usr/local/zend/lib::/usr/local/zend/lib:/usr/local/zend/lib:/usr/local/zend/lib

jess04
Posts: 628
Joined: Thu Jan 15, 2009 3:37 pm

Re: Unable to load dynamic library / fresh install

Post by jess04 » Wed Nov 25, 2009 6:12 pm

Hello,

On MAC [or Darwin], the ENV var is called DYLD_LIBRARY_PATH, not LD_LIBRARY_PATH.
Also, about mcrypt, it seems like you're missing /usr/lib/libltdl.3.dylib which, on my MAC OS 10.5 does exist. Do you have any other version of the libltdl3 somewhere on your machine? Attaching the one I have to this post, try placing it under /usr/lib and see if this helps.

Let me know if you require further assistance,
Attachments
libltdl3.tar.gz
(55.13 KiB) Downloaded 602 times
May the source be with you,

Jess Portnoy

drakos7
Posts: 6
Joined: Mon May 04, 2009 4:05 pm

Re: Unable to load dynamic library / fresh install

Post by drakos7 » Thu Dec 24, 2009 9:40 pm

On a mac, try using /usr/local/zend/bin/php-cli instead. I added a link myself
sudo ln -s /usr/local/zend/bin/php-cli /usr/bin/php-cli

shannonlp
Posts: 7
Joined: Thu Jul 02, 2009 11:58 pm

Re: Unable to load dynamic library / fresh install

Post by shannonlp » Mon Mar 22, 2010 5:46 pm

I am having the same problem. OS: Oracle Enterprise Linux 5.4 Had the same problem on CentOS 5.4

Code: Select all

echo $LD_LIBRARY_PATH 
:/usr/local/zend/lib
My profile is set as:

Code: Select all

PATH=$PATH:/usr/local/zend/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib
The error in Zend Server:

Code: Select all

[22-Mar-2010 11:12:47] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/mcrypt.so' - libmcrypt.so.4: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Mar-2010 11:12:47] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/mysql.so' - libmysqlclient.so.16: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Mar-2010 11:12:47] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/mysqli.so' - libmysqlclient.so.16: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Mar-2010 11:12:47] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/pdo_mysql.so' - libmysqlclient.so.16: cannot open shared object file: No such file or directory in Unknown on line 0
[22-Mar-2010 11:12:47] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/pdo_pgsql.so' - libpq.so.5: cannot open shared object file: No such file or directory in Unknown on line 0

jess04
Posts: 628
Joined: Thu Jan 15, 2009 3:37 pm

Re: Unable to load dynamic library / fresh install

Post by jess04 » Tue Mar 23, 2010 8:22 am

Hello,

From your output, it looks like /usr/local/zend/lib is still not included in the LD_LIBRARY_PATH ENV var.
From the shell, I suggest you execute:

Code: Select all

$ echo $LD_LIBRARY_PATH
If it does not have /usr/local/zend/lib then somewhere along the line the value you set is overridden.
When you say "My profile is set as", do you mean it is set in /etc/profile or ~/.bashrc or ~/.bash_profile? The order can be important because, as I said, it could be that a file that is being sourced after the file you set it in overrides the value.
Also, if you source /etc/zce.rc [note the space between '.' and /etc/zce.rc] in the shell before executing PHP CLI, like so:

Code: Select all

$ . /etc/zce.rc
Does it work?
May the source be with you,

Jess Portnoy

btrotter
Posts: 137
Joined: Sat Sep 05, 2009 9:11 pm

Re: Unable to load dynamic library / fresh install

Post by btrotter » Mon May 10, 2010 4:32 am

I have a cron job that is firing these errors on a similar CentOS install- how do you get LD_LIBRARY_PATH to be set right (or source zce.rc) for a root crontab?

jess04
Posts: 628
Joined: Thu Jan 15, 2009 3:37 pm

Re: Unable to load dynamic library / fresh install

Post by jess04 » Tue May 11, 2010 6:53 am

Hello,

Why don't you just export LD_LIBRARY_PATH in either /etc/profile, /root/.bashrc or any other such file that is being processed on your system?
Of course, you can also do:

Code: Select all

LD_LIBRARY_PATH=/usr/local/zend/lib /path/to/your/script 
if you prefer it.
May the source be with you,

Jess Portnoy

kevquinn
Posts: 1
Joined: Sun Jun 13, 2010 1:34 am

Re: Unable to load dynamic library / fresh install

Post by kevquinn » Fri Apr 27, 2012 1:04 pm

In case it helps, I had the same problem which was caused by /usr/local/zend/lib existing in $LD_LIBRARY_PATH 2 times instead of 1. Solution which I was able to figure out from the advice here was to set this at the command line. I believe I need to put it in my profile though. Thanks for all the help.

LD_LIBRARY_PATH=/usr/local/zend/lib

Post Reply