Alistair’s cakeBlog

Software development and philosophical musings

Entries Comments


LAMP AMD 64 Suse 9.3

20 February, 2006 (17:56) | howTo

This describes how to build a LAMP platform on Suse Linux 9.3 64 bit with PHP 5.1.2, MySql 5 and Apache 2.2.0

The first thing to watch though is Apache does not build on 64 bit Suse. It has a bug in the apr-util configure that doesn’t let you use /usr/lib64. However, the Apache folks have provided a patch, which you can get from the site.

Apache

The first thing you must do is apply the patch to srclib/apr-util/build/apu-conf.m4:
http://issues.apache.org/bugzilla/show_bug.cgi?id=28205

This will get rid of the error:

/usr/lib/libexpat.so: could not read symbols: File in wrong format

The patch updates apu-conf.m4 to build an updated configure that knows what to do with a 64 bit directive. So, once you’ve applied the patch, you should delete the file:

srclib/apr-util/configure

and go back to the root directory of the source distro and delete the configure file there too.

Then, rebuild the configure scripts:

./buildconf

You now have a 64 bit enabled apr-util. To take advantage of it, you need to add this line to the root configure options:

–enable-lib64

Here’s the root configure in full:

./configure –enable-layout=UHI         \
            –enable-lib64              \
            –libdir=/usr/lib64         \
            –enable-rewrite            \
            –enable-so                 \
            –enable-ssl                \
            –enable-userdir            \
            –without-sendfile

I usually copy this lot into a file called configure_apache. So, all you need do now is:

./configure_apache
make
make install

PHP

The next pain in the neck is PHP, which doesn’t build under 64 bit cleanly either. It’s a bit of a juggle to get the paths right but if you set:

–with-libdir=lib64

and base the other modules’ directories on that it should work ok. You should be able to build PHP with most of what you want except for a couple of modules.

LDAP

openLDAP built fine out of the box with just ./configure, make, make install. However, when you use:

–with-ldap=/usr/local/openldap

PHP tries to find the openLDAP libraries in /usr/local/openldap/lib64. Only easy way to sort this is just symlink it:

cd /usr/local/openldap
ln -s lib lib64

That’s PHP and LDAP sorted.

MySql

As PHP5 doesn’t come with MySql, you need to download the client libraries and headers from the MySql download site. Our config required the Linux AMD64 libraries and headers.

The libraries end up in /usr/lib64 but although PHP can find them, the test code it creates doesn’t compile as it can’t find them! It almost seems as though the –with-libdir=lib64 doesn’t percolate down to the raw compiler level. When you try and configure PHP you get the error in config.log:

cannot find -lmysqlclient

Anyway, to sort this, just symlink again:

cd /usr/lib64
ln -s libmysqlclient.so.14.0.0 libmysqlclient.so

to create a .so file that the compiler can find.

Here’s the PHP configure in full:

./configure –with-libdir=lib64                      \
            –with-apxs2=/usr/local/apache/bin/apxs  \
            –enable-track-vars                      \
            –enable-ftp                             \
            –enable-sockets                         \
            –with-zlib-dir=/usr                     \
            –with-libxml-dir=/usr                   \
            –with-gd                                \
            –with-mysql=/usr                        \
            –with-ldap=/usr/local/openldap          \
            –with-openssl

«

  »

Write a comment