I struggled with this issue myself when I needed to configure PHP with
OpenLDAP support. When one links shared libraries dynamically the linker
needs to find the shared libraries twice, once at compile time, and again at
run-time when you start Apache. This is why DSOs can cause problems that
static linking does not. Our LDAP shares libraries are in /usr/local/...
/lib rather than /usr/lib. Usually this would be resolved by passing the -R
option to the linker specifying the install path of the shared libraries to
be compiled into the binary. However, PHP4 does not seem to allow the -R
option to be passed to the linker, and I tried specifying LDFLAGS,
LD_LIBRARY_PATH in libtool, ltconfig, and Makefile, setting the runpath_var
and shlibpath_var in libtool, and setting libdir during configure, all
without success.
Indeed, one could set the LD_LIBRARY_PATH before starting Apache. This
should not be necessary, though. And setting an environmental variable may
affect the way in which other dynamically linked binaries run. One could
also set up symbolic links in /usr/lib to other directories like
/usr/local/lib as suggested by Steve Brazill, but this is messy and should
not be necessary either. The solution I found was to edit the config_vars
file, changing the LIBTOOL definition, removing the --silent flag. When run,
Make will use libtool without the --silent flag, and print to std output the
way in which it is using the compiler (gcc etc), and what options it is
passing to the linker. I found that the last command ran was a call the the
linker, something like:
/usr/bin/ld -G -h libphp4.so -o .libs/libphp4.so ... etc,
etc... -L/usr/local/lib ... ... -lldap -llber ... etc, etc.
I copied this command to a file, added my -R/path-to-libs option, and ran
it. Using the ldd command on the libphp4.so binary showed that the linker
was now finding the required libraries without the need for setting
LD_LIBRARY_PATH, as it should do.
I hope this helps. I would like to know why it is not easier to compile the
library path into libphp4.so with -R than going to all this hastle if anyone
knows.
Stephen Grier
----- Original Message -----
From: Steve Brazill <[EMAIL PROTECTED]>
To: Michael Middleton <[EMAIL PROTECTED]>; deco
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, March 03, 2001 7:07 PM
Subject: Re: [PHP-INST] apache+mysql+php4+redhat7
>
> Actually, a method I've been using, which seems to be the simplest way
to
> get all your 'addin' libraries seen by any of your programs (including
PHP)
> is to put 'symbolic' links in "/usr/lib" pointing to the actual library
> (though I'm lied about the RSAref library, which I actually copied into
> "/usr/lib).
>
> Since "/usr/lib" IS definitely in your library 'path', you don't have to
go
> thru the fuss of adding to it...
>
> My "/usr/lib" directory has these entries now:
>
> lrwxrwxrwx 1 root root 29 Oct 19 00:03 libmcrypt.so.4 ->
> /usr/local/lib/libmcrypt.so.4
> lrwxrwxrwx 1 root root 29 Oct 19 00:03 libmysqlclient.so ->
> /usr/local/mysql/lib/libmysqlclient.so
> -rw-r--r-- 1 root root 45800 Oct 15 15:30 librsaref.a
>
> For "MySQL" you'll have to put a link in, for whatever library it's
> complaining about (for MySQL version 3.23.XX, it seems to be
> "libmysqlclient.so.10")
>
> Also, thought the 'libmcrypt' link works, as you'll see in a lot of the
> other listings, there's a problem with "libmcrypt" version 2.4.9,
>
> ----- Original Message -----
> From: "Michael Middleton" <[EMAIL PROTECTED]>
> To: "deco" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Saturday, March 03, 2001 9:11 AM
> Subject: Re: [PHP-INST] apache+mysql+php4+redhat7
>
>
> >
> > Hi,
> >
> > Here's a copy of a message I sent to [EMAIL PROTECTED] on 27 Feb
> > 2001:
> >
> > I've had the same problem und found quite a few similar questions but no
> > answers in the archive. I even sent a mail to this list; but still no
> > reply!
> >
> > So I started worrying some of my Unix friends until one of them came up
> > with a solution.
> >
> > It appears that the options have been changed on PHP4. DSOs are no
longer
> > stored with relocation information (-R option I think - I don't know
much
> > about the compiler and loader options). The trick is to set
> > LD_LIBRARY_PATH before loading the library.
> > I put the following into apachectl :
> >
> >
LD_LIBRARY_PATH="/usr/lib:/usr/openwin/lib:/usr/dt/lib:/db/mysql/lib/mysql
> > "
> > export LD_LIBRARY_PATH
> >
> > That is, the standard path plus the path to libmysqlclient.so, which
> > libphp4.so could not find.
> >
> > I hope this helps you
> >
> > Regards
> > Mike Middleton
> >
> > On 3 Mar 2001, at 1:00, deco wrote:
> >
> > >
> > > well, i've been trying to get php and mysql working on my fresh
> > > installation of red hat 7... i decided to compile everything i need.
Got
> > > mysql working, apache working, php4 not working...
> > >
> > > following a tutorial from webmonkey, i installed php on apache as
a
> > > dso(dynamic shared object)... everything went fine, but when trying to
> > > start the apache server i get the following error:
> > >
> > > Syntax error on line 205 of /usr/local/apache/conf/httpd.conf;
> > > Cannot load /usr/local/apache/libexec/libphp4.so into server:
> > > libmysqlclient.so.
> > > 10: cannot open shared object file: No such file or directory
> > > ./bin/apachectl start: httpd could not be started
> > >
> > > following a tip from the tutorial, i added
/usr/local/apache/libexec
> > > to
> > > the /etc/ld.so.conf file... then i run ldconfig and reinstalled php4
> with
> > > the same options i had before... unfortunately the result was the
same!!
> > >
> > > i have no idea on how to solve the problem, if there is a
> > > libmysqlclient.so file somewhere, if this file's directory is the one
to
> > > add to /etc/ld.so.conf instead of /usr/local/apache/libexec, but i
> > > certainly would apreciate some kind of help!!
> > >
> > > i've been reading the archive of this mailing list and found that
> many
> > > people have problems similar to this one, but with no answers, at list
i
> > > didn't find any... so, if someone can help with something, thank you
in
> > > advance!!
> > >
> >
> > -------------------------------------------------------------
> >
> > Michael Middleton
> > RZ der Universitaet Regensburg
> > 93040 REGENSBURG Tel: +49-941/943-4890
> > F R Germany
> >
> > --
> > PHP Install Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP Install Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
--
PHP Install Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]