Unable to load dynamic library '/usr/lib/php/exten

chris (2005-09-12 03:52:39)
0 replies
This error is a pain in the behind and I have seen it appear twice now in swaret-installed slackware systems. The issues start to appear once the mysql install is upgraded. For some reason the libmysqlclient static objects aren't found by php and anything database-wise seems to fall apart.

I have been through the obvious route of back-dating the mysql installation, but to no avai. Things just seem to get worse and worse. This happened again tonight and I was getting this:

[19-Aug-2005 15:33:08] PHP Warning: Unknown(): Unable to load dynamic library '/usr/lib/php/extensions/mysql.so' - libmysqlclient.so.12: cannot open shared object file: No such file or directory in Unknown on line 0

in my php.err.

The simplest way of of this mess it to download the latest php sources from php.net and compile everything by hand. One caveat to watch out for is where you tell 'configure' to find your libraries.. A swaret installation will leave the config.status with odd paths for the mysql and gettext libs - they look like this:

--with-mysql=shared,/usr --with-gettext=shared,/usr

Yeah - weird, I know. So to get this build working on my system, I removed those paths and my final configure statement looked like:

./configure --prefix=/usr --disable-static --with-apxs=/usr/sbin/apxs --sysconfdir=/etc --enable-discard-path --with-config-file-path=/etc/apache --enable-safe-mode --with-openssl --with-mhash --enable-bcmath --with-bz2 --with-pic --enable-calendar --enable-ctype --with-gdbm --with-db3 --enable-ftp --with-iconv --with-exif --with-gd --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png --with-gmp --with-mysql --with-gettext --with-expat-dir=/usr --with-xml --enable-wddx --with-mm=/usr --enable-trans-sid --enable-shmop --enable-sockets --with-regex=php --enable-sysvsem --enable-sysvshm --enable-yp --enable-memory-limit --with-tsrm-pthreads --enable-shared --disable-debug --with-zlib=/usr

One final thing which I had to do was to move the msyql.so and gettext.so files out of their newfound home (god knows who dreamed this one up)... like this:

$ cd /usr/lib/php/extensions
$ cp no-debug-non-zts-20020429/* .

Why did they end up in there? I don't know, and I don't have time to sit here and try to guess what the hell was going on. I'd rather spend my time on produing useful php applications.. it's just a shame that things get stuffed up from time to time.

Well I hope that's vaguely useful to somebody!!