LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Compile php into a static cgi binary (https://www.linuxquestions.org/questions/linux-software-2/compile-php-into-a-static-cgi-binary-705791/)

txyoji 02-18-2009 11:33 PM

Compile php into a static cgi binary
 
Howdy folks,

I'm looking for a some help creating a portable php-cgi binary.
Magento was kind enough to create this php cgi binary for testing their software with. Its got all the php extensions they use statically compiled into it.
http://www.magentocommerce.com/knowl...-a-php4-server

That great except they left out the 'soap' library needed to use their api and no one on those forums has been helpful so far.

So I've been trying to re-compile php with the soap library.
It compiles fine using this configure statement:

Code:

'./configure' '--enable-static' '--disable-dl' '--enable-cgi' '--enable-force-cgi-redirect' '--with-config-file-path=/etc/php5cgi' '--prefix=/usr/local/php5cgi' '--with-gd' '--with-mysql' '--with-mcrypt=/home/yoji/libmcrypt-2.5.7' '--with-mhash=/home/yoji/mhash-0.9.9' '--with-curl' '--enable-ftp' '--with-openssl' '--with-dom' '--enable-sockets' '--with-zlib' '--with-zlib-dir=/usr/include' '--with-pear' '--with-jpeg' '--with-png' '--with-freetype' '--with-jpeg-dir' '--with-png-dir' '--with-pdo-mysql' '--with-mysqli' '--enable-soap' '--without-pdo-sqlite'
I statically compiled and installed mhash and mcrypt which you can see in the config.

I also have tried tweaking the makefile as outlined here:
http://www.tipcache.com/tip/Build_PH...binary_15.html

When I move the binary to the target server, I get this error:

Code:

[root@mogui~]# ./php-cgi -v
./php-cgi: error while loading shared libraries: libmhash.so.2: cannot open shared object file: No such file or directory

The binary provided by the magento team works so I know its possible, I just don't know how they did it.

I've tried with CentOS 5.1, RHEL5, and Ubuntu 8.10 (all i386)
The target OS is RHEL5

lazlow 02-18-2009 11:39 PM

I think you need to add something to include the php-soap package (at least for RHEL/Centos).

txyoji 02-18-2009 11:54 PM

Quote:

Originally Posted by lazlow (Post 3449114)
I think you need to add something to include the php-soap package (at least for RHEL/Centos).

Agreed. Normally yum install php-[whatever] does the trick.

This is a special case. The php binary I'm trying to build won't have any external dependency.

I appreciate the quick reply.

lazlow 02-19-2009 12:14 AM

Right, but you have to tell the package you are building to include the php-soap part. I do not think the '--enable-soap' will cover that.

Valery Reznic 02-20-2009 12:10 AM

Quote:

Originally Posted by txyoji (Post 3449125)
Agreed. Normally yum install php-[whatever] does the trick.

This is a special case. The php binary I'm trying to build won't have any external dependency.

I appreciate the quick reply.

You can try to use statifier (http://statifier.sf.net) or Ermine
(http://magicErmine.com) to pack original executable (either one that you complied or original one) into self-contained executable.

This way you can be rid of external dependencies.

txyoji 06-02-2009 08:06 AM

Thanks Valery. It makes sense they used a special tool to build that binary. I'll give statifier a shot.

soleilarw 06-04-2009 09:10 AM

My best guess is that your system simply lacks the required libmhash.so.2 library. Based on the name this could be some math hashing component, assumed to be available on the system already. If you add that component, then your php compilation can work without recompilation, if that's the only error.

Linux Archive


All times are GMT -5. The time now is 12:37 PM.