LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-18-2009, 11:33 PM   #1
txyoji
LQ Newbie
 
Registered: Feb 2009
Location: Texas
Distribution: CentOS 5 and Ubuntu
Posts: 5

Rep: Reputation: 0
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
 
Old 02-18-2009, 11:39 PM   #2
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
I think you need to add something to include the php-soap package (at least for RHEL/Centos).
 
Old 02-18-2009, 11:54 PM   #3
txyoji
LQ Newbie
 
Registered: Feb 2009
Location: Texas
Distribution: CentOS 5 and Ubuntu
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by lazlow View Post
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.
 
Old 02-19-2009, 12:14 AM   #4
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
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.
 
Old 02-20-2009, 12:10 AM   #5
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by txyoji View Post
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.
 
Old 06-02-2009, 08:06 AM   #6
txyoji
LQ Newbie
 
Registered: Feb 2009
Location: Texas
Distribution: CentOS 5 and Ubuntu
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks Valery. It makes sense they used a special tool to build that binary. I'll give statifier a shot.
 
Old 06-04-2009, 09:10 AM   #7
soleilarw
Member
 
Registered: Apr 2009
Posts: 107

Rep: Reputation: 19
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

Last edited by soleilarw; 06-18-2009 at 04:31 AM.
 
  


Reply

Tags
binary, gcc, libtool, php5, static, ubuntu



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Static awk or gawk binary rbautch Linux - Software 5 06-14-2011 01:41 AM
How to compile a static binary? <Ol>Origy Linux - Software 5 01-18-2009 02:27 AM
Using php6 as cgi binary vasco.debian Linux - Software 0 05-23-2008 07:22 AM
Perl programs downloading as binary via cgi/apache? jon_k Linux - Software 1 02-22-2007 05:28 AM
Binary -- static or dynamic ? swiadek Linux - General 2 02-11-2006 04:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration