Monday, October 29, 2007

XML2 Libraries on Solaris

SUNWlxml sticks an ancient version of libxml2 in /usr/lib.

However the current version of the libxml2 package from sunfreeware.com is SMClxml2, which sticks libxml2 into /usr/local/lib.

libexec/libphp5.so looks for some XML functions that it expects to find in libxml2, which it can't until you change LD_LIBRARY_PATH.

In all fairness, this could just as easily have happened if you had used Linux instead of Solaris as your Web serving platform.

Labels:

Friday, October 26, 2007

Building PHP on Solaris

Is kinda painful, primarily because the Solaris libraries clash with the GNU libraries that PHP expects. So here are some of the problems I ran into when installing PHP 5.2.4 on Solaris 10:


1. During configure, you'll get an error that says something to the effect that the "-E" option is unsupported. Thats easy, you just change "grep" to "/usr/local/bin/grep", or wherever you have GNU grep installed.


2. Again, configure will complain about incorrect status from expr and a broken test. There is one instance where 2 shell vars are added. Use let from BASH instead of mucking with the Solaris expr. Also change all occurrences of expr to /bin/expr.


3. Install any missing packages from sunfreeware.com. I built PHP from scratch because I needed to make it work for an apache 1.3 installation, and the SUN freeware site helpfully included a libphp5.so that seemed to only work for apache 2.x.


4. When you finally have everything up and running, trying to start httpd will result in this:
bash-2.05a$ ./apache restart
httpd restarting.
bash-2.05a$ /home/cariapa/apache/bin/apachectl restart: configuration broken, ignoring restart
/home/cariapa/apache/bin/apachectl restart: (run 'apachectl configtest' for details)
bash-2.05a$ cd ../bin
bash-2.05a$ ./apachectl configtest
Syntax error on line 262 of /home/cariapa/apache/conf/httpd.conf:
Cannot load /home/cariapa/apache/libexec/libphp5.so into server: ld.so.1: httpd: fatal: relocation error: file /home/cariapa/apache/libexec/libphp5.so: symbol xmlParserInputBufferCreateFilenameDefault: referenced symbol not found
bash-2.05a$ echo $LD_LIBRARY_PATH
/usr/lib:/usr/X/lib:/usr/local/lib
bash-2.05a$ LD_LIBRARY_PATH="/usr/local/lib:/usr/lib:/usr/X/lib"
bash-2.05a$ ./apachectl configtest
Syntax OK

So evidently Solaris sticks some kind of XML2 library in /usr/lib, which is part of another Solaris XML package. Avoid!

As an addendum, making PHP with all options on this Sun T200, Solaris 10 system took about 10 minutes. 8GB of memory, Dec 2005 vintage. AFAIK it was only serving up a couple of static web pages at the time. I later compiled PHP at home on my little Dell Inspiron (also 2005 model) running Centos 5. Again all options, 512 GB of RAM, 1 PentiumM 1.8GHz. Took about 2 minutes. I make cleaned to make sure I wasn't doing something wrong, and ran it again. Same time.

Can't see why anyone would choose SUN/Solaris over AMD/Intel/Linux.