Php-CGI compile as a static binary

Discussion in 'Programming/Scripts' started by vampire, Sep 4, 2011.

  1. vampire

    vampire New Member

    Hello,

    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! :)
     
  2. vampire

    vampire New Member

  3. falko

    falko Super Moderator

    Do you get any errors?
     
  4. vampire

    vampire New Member

    Yes,

    I try to compile php 5.3.3, I use this command

    PHP:
    ./configure --enable-gd-native-ttf --enable-static=yes \
        --
    disable-cli \
        --
    with-config-file-path='/cgi-bin/' \
        --
    prefix='/usr/local/php5cgi' \
        --
    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:
    creating libtool
    appending configuration tag 
    "CXX" to libtool

    Generating files
    creating 
    ./config.status
    creating php5
    .spec
    creating main
    /build-defs.h
    creating scripts
    /phpize
    creating scripts
    /man1/phpize.1
    creating scripts
    /php-config
    creating scripts
    /man1/php-config.1
    creating main
    /php_config.h
    creating main
    /internal_functions.c
    creating main
    /internal_functions_cli.c
    +--------------------------------------------------------------------+
    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.

    testing:~/php-5.3.3#
    And che configure it's ok, I edit the "Makefile" such as the guide, and the error is:

    PHP:
    /usr/bin/ldattempted static link of dynamic object `/usr/lib/libmcrypt.so'
    collect2: ld returned 1 exit status
    make: *** [sapi/cgi/php-cgi] Error 1
    The file it's ok

    PHP:
    testing:~/php-5.3.3# ls -la /usr/lib/libmcrypt.so
    lrwxrwxrwx 1 root root 18 Sep  3 17:56 /usr/lib/libmcrypt.so -> libmcrypt.so.4.4.7
    Any solution?
     
  5. vampire

    vampire New Member

    The output of ld command is that

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

Share This Page