Web Hosting Talk







View Full Version : Compiling static standalone PHP binary ???


akbsol
06-23-2007, 12:52 AM
Hi everyone,

I am using the following configure command in hope to generate a PHP binary which is totally independent, standalone and can be moved to other systems without caring for dependencies:

./configure --enable-fastcgi --enable-force-cgi-redirect --enable-discard-path --prefix=/server/php --exec-prefix=/server/php --with-config-file-path=/server/php --disable-all --enable-shared=no --enable-static=yes --enable-session --with-gd --with-zlib-dir --with-freetype-dir --enable-sockets

But when I try to run the generated binary on another system which doesn't have freetype etc installed, I get the following error:

error while loading shared libraries: libfreetype.so.6

Can anyone tell me as to what m I doing wrong?

Thanks..

luki
06-23-2007, 03:55 AM
Making a completely static PHP is a tricky business, because it itself links against libraries that may have external dependencies. My bet is that libgd.so had a dependency on libfreetype.so, so even your PHP binary may be linked statically against libgd.so, libgd.so itself has a dynamic dependency. You can check with ldd to get an idea.

Unfortunately I don't have any tips to help you resolve that.

akbsol
06-23-2007, 10:19 AM
thx a lot for your help.. i finally found the solution here:

http://forums.devshed.com/php-development-5/compiling-static-standalone-php-binary-454657.html