Entropy.ch Discussion Forums Forum Index Entropy.ch Discussion Forums
Discussion forums about Mac OS X software development.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Rolling own libphp5.so fails on Leopard

 
Post new topic   Reply to topic    Entropy.ch Discussion Forums Forum Index -> PHP on Mac OS X
View previous topic :: View next topic  
Author Message
denvertimothy



Joined: 29 Oct 2007
Posts: 4

PostPosted: Mon Oct 29, 2007 21:44    Post subject: Rolling own libphp5.so fails on Leopard Reply with quote

I've documented my attempt to create my own PHP5 DSO on Leopard because the included one doesn't support PostgreSQL. You can see here:

http://reduxcomputing.com/leopard-php5.html

I can get it compile fine, but when apache loads it, it results in some kind of "architecture" problem. Is anybody familiar with this problem?

Depending on how it compiles, the error varies. Here's the key excerpts from the write so you know if you're looking at the same thing:

Syntax error on line 114 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/libphp5.so: no matching architecture in universal wrapper

Syntax error on line 114 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/libphp5.so: mach-o, but wrong architecture
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mickey79



Joined: 31 Jul 2007
Posts: 40

PostPosted: Mon Oct 29, 2007 21:54    Post subject: Reply with quote

In my quest for finding a solution to my problem - I came across the exact same problem you've mention and it's solution on some other forum. Let me look it up - I can't remember where I saw it, but I saw somebody talking about it .
Back to top
View user's profile Send private message
mickey79



Joined: 31 Jul 2007
Posts: 40

PostPosted: Mon Oct 29, 2007 21:59    Post subject: Reply with quote

Alright found it!

This is the thread: http://discussions.apple.com/thread.jspa?messageID=5676677&tstart=0

This is the post from someone who had a similar problem:

Recompiling PHP would involve installing the Developer Tools off the Leopard DVD and downloading the PHP source from php.net.

I wouldn't quite recommend that yet as I have done that and have ended up in a worse situation than when I had started. Basically I downloaded the GD library, libjpeg, libpng libraries, got those installed. Then got the PHP source unzipped and configured with:

./configure --with-zlib --with-jpeg-dir=/usr/local/bin --with-png-dir=/usr/local/bin --with-gd --with-mysql=/usr/local/mysql --with-libxml-dir=/usr/local/lib/python2.5/site-packages --with-curl --with-apxs2

Compiled and installed, but Apache was no longer able to start with the PHP5 module. The error that comes back when I try to start Apache is:

httpd: Syntax error on line 114 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/libphp5.so: mach-o, but wrong architecture

I'm wondering if PHP is being built in 32bit but Apache in Leopard is 64bit. I can't seem to find any information on this problem.

~~~~~~~~~~~~~~~~~~~

Solution has been found!

The same thing here - after building PHP from source, i get the same error message: Cannot load /usr/libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/libphp5.so: mach-o, but wrong architecture

I've been able to eliminate the whole problem by recompiling Apache2 from source:

./configure --enable-layout=Darwin --enable-mods-shared=all
make
make install

It's even not necessary to rebuild PHP after that. Just relaunch web sharing in System Preferences > Sharing

I think the problem was in apxs2, which was, i suppose, compiled in universal binary format as shipped in Leopard.
Back to top
View user's profile Send private message
denvertimothy



Joined: 29 Oct 2007
Posts: 4

PostPosted: Thu Nov 01, 2007 7:33    Post subject: Reply with quote

Indeed, it does work! Good enough for now. Been working like this for about 4 days now. Seems to be no side effects. However, I will be interested to see what comes of this, because this way doesn't seem to be ultimate best solution.

mickey79 wrote:

./configure --enable-layout=Darwin --enable-mods-shared=all
make
make install

It's even not necessary to rebuild PHP after that. Just relaunch web sharing in System Preferences > Sharing


Although, I did use my custom PHP DSO because I needed Postgres support.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ebi



Joined: 31 Oct 2007
Posts: 4
Location: Züri

PostPosted: Thu Nov 01, 2007 13:01    Post subject: Re: Rolling own libphp5.so fails on Leopard Reply with quote

denvertimothy wrote:
I can get it compile fine, but when apache loads it, it results in some kind of "architecture" problem. Is anybody familiar with this problem?


mickey79 wrote:
I'm wondering if PHP is being built in 32bit but Apache in Leopard is 64bit. I can't seem to find any information on this problem.


That seems to be the case and is somehow solved Smile See http://www.entropy.ch/phpbb2/viewtopic.php?p=10861#10861
Back to top
View user's profile Send private message
vielinko



Joined: 08 Sep 2008
Posts: 4

PostPosted: Fri Sep 19, 2008 21:10    Post subject: Reply with quote

Quote:

Solution has been found!

The same thing here - after building PHP from source, i get the same error message: Cannot load /usr/libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/libphp5.so: mach-o, but wrong architecture

I've been able to eliminate the whole problem by recompiling Apache2 from source:

./configure --enable-layout=Darwin --enable-mods-shared=all
make
make install


Hello, I know that i'm posting out of date Smile ... but this forum help me too much to solve 1 of 2 problems.

The quote's message really help me, because my apache (httpd) didnt startup when I tried to use PHP5 module. After recompile it, works fine ... btw, I have Leopard (10.5.4) and need to practice PHP because my homeworks Smile ...

The 2nd problem that i had, was my MySQL ODBC Connector for Leopard, from mysql site, the last release works fine on Tiger (10.4.*) ... i tried to recompile the mysql connector' source to Tiger into Leopard ... but didnt works ... I just doesn't use ODBC anymore for mysql connection ... I still finding a Free alternative, because I just need it to do my homework Very Happy ....

rgds
Viel.

p.s. Omg! it's my first post in here Smile ...
Back to top
View user's profile Send private message
fazthegreat



Joined: 15 Apr 2009
Posts: 2

PostPosted: Fri May 29, 2009 17:35    Post subject: Reply with quote

I'm having some problems with my installation, wish this forum was a bit more active. A few posts I found were a great help.
_________________
Medical Scheduling Software | Tax Preparer Payroll Company | Business Incorporation
Back to top
View user's profile Send private message
vielinko



Joined: 08 Sep 2008
Posts: 4

PostPosted: Thu Jun 04, 2009 18:17    Post subject: Reply with quote

fazthegreat wrote:
I'm having some problems with my installation, wish this forum was a bit more active. A few posts I found were a great help.


Post your problem, maybe someone can help you Wink ... don't be shine Very Happy
Back to top
View user's profile Send private message
Dionnah



Joined: 15 Aug 2009
Posts: 2

PostPosted: Sat Aug 15, 2009 14:21    Post subject: Reply with quote

" Don't be shine". LoL!

I can help you with that Fazthegreat. Please send a PM and I will guide you how to do it.


Pret immobilier
Back to top
View user's profile Send private message
vielinko



Joined: 08 Sep 2008
Posts: 4

PostPosted: Tue Aug 18, 2009 5:50    Post subject: Reply with quote

Dionnah wrote:
" Don't be shine". LoL!

I can help you with that Fazthegreat. Please send a PM and I will guide you how to do it.


Pret immobilier


Hello Smile .... I think that you most share your tips with all ppl that needs it Sad ... Usually The post solutions can help ...
Back to top
View user's profile Send private message
vielinko



Joined: 08 Sep 2008
Posts: 4

PostPosted: Tue Aug 18, 2009 5:55    Post subject: Reply with quote

vielinko wrote:

The 2nd problem that i had, was my MySQL ODBC Connector for Leopard, from mysql site, the last release works fine on Tiger (10.4.*) ... i tried to recompile the mysql connector' source to Tiger into Leopard ... but didnt works ... I just doesn't use ODBC anymore for mysql connection ... I still finding a Free alternative, because I just need it to do my homework Very Happy ....


Btw ... Finally, I didnt use ODBC for my PHP connections. Just use something like that



Code:

con = mysql_connect('127.0.0.1:3306', 'root', '') or die('Error: Cannot connect to MySQL');


Smile maybe someone find useful.
Back to top
View user's profile Send private message
josephla



Joined: 05 Oct 2009
Posts: 1

PostPosted: Mon Oct 05, 2009 18:59    Post subject: Reply with quote

hi,

i'm wondering if the solution from mickey79 in oct 2007 still holds for this error on darwin? i only need to recompile apache2 and it should clear the error?

tia,
joey
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Entropy.ch Discussion Forums Forum Index -> PHP on Mac OS X All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group