Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40438 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79402 invoked from network); 10 Sep 2008 15:31:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Sep 2008 15:31:18 -0000 Authentication-Results: pb1.pair.com header.from=santi@usansolo.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=santi@usansolo.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain usansolo.net designates 82.194.80.170 as permitted sender) X-PHP-List-Original-Sender: santi@usansolo.net X-Host-Fingerprint: 82.194.80.170 relayout02-q01.dns-servicios.com Linux 2.6 Received: from [82.194.80.170] ([82.194.80.170:38459] helo=relayout02-q01.dns-servicios.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5B/CF-30769-448E7C84 for ; Wed, 10 Sep 2008 11:31:17 -0400 Received: from relayout02-redir.dns-servicios.com (relayout02-redir.dns-servicios.com [82.194.80.175]) by relayout02.dns-servicios.com (Postfix) with ESMTP id 2AEA4D18248; Wed, 10 Sep 2008 17:31:13 +0200 (CEST) Received: from linux11.dns-servicios.com (linux11.dns-servicios.com [82.194.66.135]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by relayout02-dsp.dns-servicios.com (Postfix) with ESMTPS id 5F63E390934; Wed, 10 Sep 2008 17:31:05 +0200 (CEST) Received: from [127.0.0.1] (port=36618 helo=mail.usansolo.net) by linux11.dns-servicios.com with esmtpa (Exim 4.69) (envelope-from ) id 1KdReq-0002mD-54; Wed, 10 Sep 2008 17:31:04 +0200 MIME-Version: 1.0 Date: Wed, 10 Sep 2008 17:31:04 +0200 To: internals@lists.php.net Cc: =?UTF-8?Q?Cristian_Rodr=C3=ADguez?= In-Reply-To: <48C7E278.5040204@suse.de> References: <48C7E278.5040204@suse.de> Message-ID: <0c8e1be56e8889088c5c82e10713662b@usansolo.net> X-Sender: santi@usansolo.net User-Agent: RoundCube Webmail/0.1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-RelayOut-Watermark: 1221665465.54475@Vl6/M329umsdPRh3zMLsYg X-RelayOut-Information: AntiSPAM and AntiVIRUS on relayout02 X-RelayOut: Found to be clean X-RelayOut-SpamCheck: no es spam, SpamAssassin (no almacenado, puntaje=0, requerido 6.5) X-RelayOut-From: santi@usansolo.net X-Spam-Status: No Subject: Re: [PHP-DEV] Howto build statically linked PHP CGI (without shared libs) From: santi@usansolo.net On Wed, 10 Sep 2008 11:06:32 -0400, Cristian Rodríguez wrote: Dear Cristian, >> I'm trying to compile a statically linked, without shared libs, > > Why you want such thing ? We want to provide a method to "customize" PHP version to our clients; for example, all our servers run with PHP 5.1.6, but if one client needs PHP v5.2.6 to run X CMS.. so we provide a statically linked version of the CGI for 5.2.6. In the future, if we upgrade from CentOS 4 to CentOS 5 (for example).. all clients running with the default PHP version in the server will not have problem. But clients with "personalized" PHP version running as CGI, will have problems: there will be no available the shared libs wich is dynamically linked to.. So, we want to provide this version of the CGI.., we know that the version of the CGI will be bigger, and that's not a good idea, but we need to do it ;-( >> How can I compile statically the CGI version of PHP? Thanks!! > > even if you manage to link all libraries statically, you will end with a > huge, memory hungry and hard to debug php binary that anyways require > shared libc at runtime ;-P Yes, it maybe a problem.. Now we're using statifier [1] to convert dynamically linked executables and all it's libraries in one file: # file php-cgi php-cgi: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped # ldd php-cgi | head -10 libcrypt.so.1 => /lib/libcrypt.so.1 (0x00335000) libc-client.so.0 => /usr/lib/libc-client.so.0 (0x00397000) libexslt.so.0 => /usr/lib/libexslt.so.0 (0x00367000) libz.so.1 => /usr/lib/libz.so.1 (0x00323000) libm.so.6 => /lib/tls/libm.so.6 (0x002fe000) libaspell.so.15 => /usr/lib/libaspell.so.15 (0x00767000) libpspell.so.15 => /usr/lib/libpspell.so.15 (0x00111000) librt.so.1 => /lib/tls/librt.so.1 (0x006b2000) libmysqlclient.so.14 => /usr/lib/mysql/libmysqlclient.so.14 (0x001c8000) libmcrypt.so.4 => /usr/lib/libmcrypt.so.4 (0x00f67000) # statifier php-cgi php-cgi.statifier # file php-cgi.statifier php-cgi.statifier: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, not stripped # ldd php-cgi.statifier not a dynamic executable statifier'd version of the CGI works fine.. but we're looking a better method to directly built the CGI. # ls -lh php-cgi php-cgi.statifier -rwxr-xr-x 1 root root 7.0M Sep 10 15:10 php-cgi -rwxr-xr-x 1 root root 19M Sep 10 17:14 php-cgi.statifier Regards, [1] http://statifier.sourceforge.net/ -- Santi Saez http://woop.es