[NCLUG] Static compiles

Michael Dwyer mdwyer at sixthdimension.com
Fri May 31 14:11:24 MDT 2002


Joshua SS Miller wrote:
> I am looking to compile static versions of php and apache, but
> not being a programmer I need a little help.  What I need to end
> up with is a Apache and php module that do not depend on any thing
> else on the box.  I want to be able to move it to another Linux box
> and it just runs, no complaining "*lib not found".  All boxes will
> be x86 running the Linux kernel, so I know that much, other then that I
> can not say how much they will diff.

I've always compiled my PHP static /into/ Apache.  This means that you
don't need a php library stuck on the outside.  The directions for this
are in the PHP documentation.  In general, it is something like:

   ./configure --with-apache=../apache-1.3

...though, you actually have to run it twice... See the readme's to see
what I mean.

As for getting the rest of Apache to compile static... uh... yikes.  It
is going to be HUGE, I hope you are aware...  I believe that you can add
the -STATIC option to the compiler/linker arguments in the makefiles.

Possibly a better alternative is to carefully craft your Apache/PHP
binary so that it doesn't include any strange libraries that you don't
need.  PHP has a LOT of compilation options.  But if you decide that,
for instance, you don't need the GD functionality, you can leave off a
LOT of extra libraries -- like libtiff and libpng and libjpeg.  If you
aren't going to be running a webmail system, you can leave off the IMAP
stuff. 

This might be a better way to do it.  I consider myself a
built-in-to-Apache-static PHP compiling ninja, so I might be able to
help you chose which options you want...



More information about the NCLUG mailing list