FYI: compile php4 compress uncompress libmysqlclient issue

From: Date: Sun, 25 Mar 2001 08:39:04 +0000
Subject: FYI: compile php4 compress uncompress libmysqlclient issue
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45476@lists.php.net to get a copy of this message
Hi all. Firstly apoligies to those on the list who receive every email to the general list in their inbox like I do :-) I've just spent a rather frustrating five days (15hrs/day) trying to compile php 4 for use both at the command line and within apache 1.3.12 (openssl/mod_ssl). I've scanned the lists and internet looking for solutions to the issue outlined in the subject above and have found the following solution, which I am posting for future refernce, so hopefully it will help others. This is the procedure I used to produce the php binary (CGI) but the mods to build the apache stuff are minimal. I haven't tested either of these yet but I think there are 2 options for the apache side of things: FOR APXS: --with-apxs=/usr/local/apache/bin/apxs (or wherever your apache source tree is) FOR STATIC?: --with-apache=../apache_1.3.12 (or wherever your apache source tree is) Add either line to the Build_php4 script below. If anything in here looks really wrong can somebody please modify it accordingly and repost it. If this is considered an inappropriate post, can somebody let me know a better place to put it (or even better a Web Site to put it on). The issue is with PHP not being able to find the compress and uncompress routines when calling/compiling using the MySQL libmysqlclient library. The 2 routines in questions belong to the Zlib compression. (The nm tool can be used to show that the routines are marked as "UNDEF" which means they are from another externally called library) The scenario/setup ------------------ SCO Openserver 5.0.5 mysql-3.23.28-gamma php-4.0.4pl1 (although I tried 4.0pl2 as well) apache_1.3.12 zlib_1.1.2 Everything I build is from /usr/local/Build I use /usr/local (the default) for the --prefix option to configure scripts. I also have things like GD, OpenSSL, Mod_SSL, BerkeleyDB (what a drama) and a whole bunch of stuff froim the SCO Skunkware brigade (http://www.sco.com/skunkware). What I did (My scripts etc) ---------- The first tricky thing I found was to ensure that programs could find the libraries when required. Much searching of the NET came up with some things I have put into a script: -------/usr/local/bin/LD.sh------- #!/bin/sh LD_LIBRARY_PATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:/usr/local/lib/mys ql LIBPATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:/usr/local/lib/mysql SHLIB_PATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:/usr/local/lib/mysql if [ -f /usr/local/openlink/openlink.sh ]; then . /usr/local/openlink/openlink.sh fi export LD_LIBRARY_PATH LIBPATH SHLIB_PATH ------------------------------------------ I note that by default SCO looks for libraries in /lib and /usr/lib. Creating symbolic links from /usr/local/lib etc into /usr/lib also seems to work, rather than the variables. I am not a C programmer so I have no real idea what the 3 environment variables are and I believe that there is another one called LD_RUN_PATH as well, but I don't seem to need it. On the apache front, I modified my apachectl startup script to call this script with ". /usr/local/bin/LD.sh" (the dot is crucial) to import the variables into the script before starting apache so apache can find the libraries and openlink stuff as well. For Linux users this stuff is unnecessary (I think) as you can modify /etc/ld.so.conf to add any non standard directory like /usr/local/mysql/lib (the default I think). Then run ldconfig to rebuild the list (I can't remember if a reboot is necessary but I don't think so) and voila, linux can find the libraries required. MYSQL - with zlib compression enabled - my libz.* files reside in /usr/local/lib Configured MySQL ready to run make with the following script: ---------Build_mysql------------ rm -f config.cache ./configure \ --prefix=/usr/local \ --enable-assembler \ --enable-large-files \ --without-debug \ --with-comment \ --without-bench \ --with-named-z-libs=z \ --with-berkely-db=/usr/local -------------------------------- PHP4 1) I modified the PHP configure script (using information from a previous post regarding modifying Makefiles) to add -lz (to have PHP include the Zlib libraries any time is uses mysql). In my case the relevant lines were: 25577 Changed From MYSQL_SHARED_LIBADD="-lmysqlclient $MYSQL_SHARED_LIBADD" Changed To MYSQL_SHARED_LIBADD="-lmysqlclient -lz $MYSQL_SHARED_LIBADD" 25657 Changed From LIBS="-lmysqlclient $LIBS" Changed To LIBS="-lmysqlclient -lz $LIBS" 2) Configured PHP ready to run make with the following script: Most of the stuff is irrelevant to the issue and some of the options are ignored, but I haven't work out which ones yet. I think having the with-openlink line means the the without-iodbc line is ignored. ---------Build_php4------------- rm -f config.cache ./configure \ --with-openlink \ --with-zlib-dir=/usr/local \ --with-dbm \ --with-mysql=/usr/local \ --without-iodbc \ --enable-discard-path=yes \ --enable-magic-quotes=yes \ --enable-track-vars=yes \ --enable-memory-limit \ --enable-trans-sid \ --enable-versioning \ --enable-shared=yes \ --enable-static=no \ --disable-pear \ --disable-xml \ --disable-bcmath \ --disable-calendar \ --without-gd \ --without-cybercash \ --without-mod-dav \ --without-gdbm \ --without-ndbm \ --without-db2 \ --without-db3 \ --without-cdb \ --without-dom \ --without-gettext \ --without-hyperwave \ --without-icap \ --without-imap \ --without-ldap \ --without-mcal \ --without-mcrypt \ --without-mhash \ --without-custom-odbc \ --without-pdflib -------------------------------- The php binary when installed (in mycase) in /usr/local/bin works and preforms all of the SELECT, UPDATE, DELETE stuff I have thrown at it so far. It you run the ldd command on it you get this. # ldd /usr/local/bin/php dynamic linker: /usr/local/bin/php: file loaded: /usr/lib/libiodbc.so dynamic linker: /usr/local/bin/php: file loaded: /usr/local/lib/mysql/libmysqlclient.so10 dynamic linker: /usr/local/bin/php: file loaded: /usr/local/lib/libz.so.1 dynamic linker: /usr/local/bin/php: file loaded: /usr/lib/libsocket.so.1 dynamic linker: /usr/local/bin/php: file loaded: /usr/lib/libc.so.1 NOTES: There is probably a whole lot of stuff that is a bit wrong with what I have done above, but a functioning binary was all I was after. I would appreciate any feedback on this. Regards Grant Walters Brainbench 'Most Valuable Professional' for Unix Admin Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989

« previous php.general (#45476) next »