HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   Programming/Scripts (
-   -   Php-CGI compile as a static binary (

vampire 4th September 2011 02:14

Php-CGI compile as a static binary

Do anyone know how I can compile php as a static binary?

My actual hosting have php 5.2.10 and it don't want do the upgrade to php53, I know that is possible compile php as a static binary, I have search on google but I don't find nothing that work.

Do you know any method for build an php-cgi binary with static library and run it in anyone servers?

Thanks you guys! :)

vampire 4th September 2011 02:15

I have try that guide

but don't works.

falko 4th September 2011 20:10

Do you get any errors?

vampire 4th September 2011 21:03


I try to compile php 5.3.3, I use this command

PHP Code:

./configure --enable-gd-native-ttf --enable-static=yes 
--with-gd --with-mysql --with-mcrypt='/usr/lib' --with-mhash --with-curl='/usr/lib' 
--enable-ftp --with-openssl --enable-sockets 
--with-zlib --with-zlib-dir='/usr/include' 
--with-pear --enable-soap 
--with-imap --with-imap-ssl --with-kerberos 
--with-jpeg-dir='/usr/lib' --with-png-dir=/usr/lib --with-pdo-mysql --with-mysqli 
--enable-bcmath --enable-zip --with-freetype-dir='/usr/lib' 
--with-xsl --with-xmlrpc --with-libxml-dir='/usr/lib' --with-sqlite 
--with-pdo-sqlite --with-pcre-dir='/usr/lib' --with-bz2 --with-xpm-dir=/usr/lib 

PHP Code:

creating libtool
appending configuration tag 
"CXX" to libtool

Generating files
creating php5
creating main
creating scripts
creating scripts
creating scripts
creating scripts
creating main
creating main
creating main
License:                                                           |
This software is subject to the PHP Licenseavailable in this     |
distribution in the file LICENSE.  By continuing this installation |
processyou are bound by the terms of this license agreement.     |
| If 
you do not agree with the terms of this licenseyou must abort |
the installation process at this point.                            |

Thank you for using PHP.


And che configure it's ok, I edit the "Makefile" such as the guide, and the error is:

PHP Code:

/usr/bin/ldattempted static link of dynamic object `/usr/lib/'
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1 

The file it's ok

PHP Code:

testing:~/php-5.3.3# ls -la /usr/lib/
lrwxrwxrwx 1 root root 18 Sep  3 17:56 /usr/lib/ -> 

Any solution?

vampire 4th September 2011 21:08

The output of ld command is that

PHP Code:

testing:~/php-5.3.3# /usr/bin/ld /usr/lib/
/usr/bin/ldwarningcannot find entry symbol _startnot setting start address 

All times are GMT +2. The time now is 16:36.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.