I realize this may be a bit out of scope.
I wanted to find out if anyone's had any success in making a statically linked (non-shared-library-dependant) version of PHP for linux.
My current attempt goes like this:
export LDFLAGS='--static'
'./configure' '--prefix=/opt/php' '--exec-prefix=/opt/php' '--with-config-file-path=/opt/php' --disable-shared --enable-static '--with-mysql=static' '--disable-debug' '--with-dom' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--enable-magic-quotes' '--enable-sysvsem' '--enable-sysvshm' '--enable-trans-sid' '--with-mcal' '--with-mcrypt' '--with-iconv' '--enable-mbstring' '--with-mbstring=all' '--enable-cgi' '--enable-track-vars' '--enable-memory-limit' '--enable-ftp' '--enable-calendar' '--with-kerberos' '--with-jpeg-dir' '--with-gettext' '--enable-versioning' '--enable-fastcgi' '--enable-force-cgi-redirect' '--with-zlib' '--with-gd' '--with-ldap' '--with-curl' '--with-zip' '--enable-ftp' '--with-openssl'
make LDFLAGS="--all-static"
That's from what information I could get by googling around, but it still makes a library dependant executable (ldd dump🙂
libcrypt.so.1 => /lib/libcrypt.so.1 (0x4001f000)
libmysqlclient.so.12 => /usr/lib/libmysqlclient.so.12 (0x4004c000)
libz.so.1 => /usr/lib/libz.so.1 (0x4008d000)
libm.so.6 => /lib/libm.so.6 (0x400a0000)
libssl.so.0.9.7 => /usr/lib/i686/cmov/libssl.so.0.9.7 (0x400c2000)
libcrypto.so.0.9.7 => /usr/lib/i686/cmov/libcrypto.so.0.9.7 (0x400f3000)
libmcrypt.so.4 => /usr/lib/libmcrypt.so.4 (0x401f2000)
libltdl.so.3 => /usr/lib/libltdl.so.3 (0x40220000)
libdl.so.2 => /lib/libdl.so.2 (0x40227000)
libldap.so.2 => /usr/lib/libldap.so.2 (0x4022b000)
liblber.so.2 => /usr/lib/liblber.so.2 (0x4025f000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0x4026c000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x40291000)
libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x402af000)
libresolv.so.2 => /lib/libresolv.so.2 (0x402bf000)
libnsl.so.1 => /lib/libnsl.so.1 (0x402d2000)
libcurl.so.2 => /usr/lib/libcurl.so.2 (0x402e7000)
libxml2.so.2 => /usr/lib/libxml2.so.2 (0x40314000)
libpthread.so.0 => /lib/libpthread.so.0 (0x4040f000)
libc.so.6 => /lib/libc.so.6 (0x40460000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x40593000)
libgnutls.so.11 => /usr/lib/libgnutls.so.11 (0x405a9000)
libtasn1.so.2 => /usr/lib/libtasn1.so.2 (0x4060f000)
libgcrypt.so.11 => /usr/lib/libgcrypt.so.11 (0x4061f000)
libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x4066c000)
The reason for all of this is that I work with Damn Small Linux, for the most part, and I want to build a module for DSL that does not require the use of mkwriteable (DSL is based on Knoppix. As such, most of the filesystem is read-only. mkwriteable creates the filesystem folders, symlinks everything from the read-only versions, and chroots to the ramdisk. The upshot is that some RAM is used for making everything writable, then for extracting the binaries in the distribution) and can be loaded as a UCI (Unified Compressed ISO. It's a compressed iso9660 filesystem that can be mounted via the cloop module). You see, if I can get PHP (5.0.3) entirely contained within /opt/php, I can save end-users a lot of ram use.
Wow, that was long-winded.
Anyway, if you can help, please reply!