| View previous topic :: View next topic |
| Author |
Message |
mickey79
Joined: 31 Jul 2007 Posts: 40
|
Posted: Mon Oct 29, 2007 22:02 Post subject: |
|
|
You are a rock star - to say the least.
Thank you so much for looking into this - I think a lot of us are waiting for the updated package. Can't thank you or appreciate you enough for all your efforts! |
|
| Back to top |
|
 |
strawhousepig
Joined: 28 Oct 2007 Posts: 1
|
Posted: Tue Oct 30, 2007 5:28 Post subject: |
|
|
I upgraded to your Apache2 PHP package (from the 1.3 package) and I had to make a symlink: | Code: | sudo ln -s /usr/local/apache2/lib/libexpat.0.dylib /usr/lib/libexpat.1.5.0.dylib
|
Keep in mind that /usr/local/apache2/lib does not exist! You'll need to mkdir in usr/local first.
Apache started fine after that.
Keep in mind this is a fuzzy memory of a middle of the night emergency server resurrection after installing 10.5. I may have done that before installing the Apache2 PHP package.
Thanks for the hard work, btw.  |
|
| Back to top |
|
 |
liyanage Site Admin

Joined: 22 May 2003 Posts: 1104 Location: Zurich, Switzerland
|
Posted: Tue Oct 30, 2007 9:14 Post subject: |
|
|
| strawhousepig wrote: | I upgraded to your Apache2 PHP package (from the 1.3 package) and I had to make a symlink: | Code: | sudo ln -s /usr/local/apache2/lib/libexpat.0.dylib /usr/lib/libexpat.1.5.0.dylib
|
|
That is pretty interesting, I was wondering if that would work but didn't have time to try it... |
|
| Back to top |
|
 |
johanhenselmans
Joined: 18 Feb 2005 Posts: 8
|
Posted: Tue Oct 30, 2007 9:30 Post subject: It's the CPU architecture as well |
|
|
I noticed that it is not only the change of location that plays a role. I had entropy-php running on a core2 macbook on Tiger. That will not work now. The reason is that macbook-leopard demands 64 bits compiles. This is what the php library of Apple says:
ppp4:~ johan$ file /usr/libexec/apache2/libphp5.so
/usr/libexec/apache2/libphp5.so: Mach-O universal binary with 4 architectures
/usr/libexec/apache2/libphp5.so (for architecture ppc7400): Mach-O bundle ppc
/usr/libexec/apache2/libphp5.so (for architecture ppc64): Mach-O 64-bit bundle ppc64
/usr/libexec/apache2/libphp5.so (for architecture i386): Mach-O bundle i386
/usr/libexec/apache2/libphp5.so (for architecture x86_64): Mach-O 64-bit bundle x86_64
Also in the error messages I got this:
Oct 29 09:41:54 diomedea org.apache.httpd[1218]: httpd: Syntax error on line 484 of /private/etc/apache2/httpd.conf: Syntax error on line 8
of /private/etc/apache2/other/+entropy-php.conf: Cannot load /usr/local/php5/libphp5.so into server: dlopen(/usr/local/php5/libphp5.so, 10
): no suitable image found. Did find:\n\t/usr/local/php5/libphp5.so: no matching architecture in universal wrapper |
|
| Back to top |
|
 |
liyanage Site Admin

Joined: 22 May 2003 Posts: 1104 Location: Zurich, Switzerland
|
Posted: Tue Oct 30, 2007 10:14 Post subject: Re: It's the CPU architecture as well |
|
|
| johanhenselmans wrote: | | The reason is that macbook-leopard demands 64 bits compiles. |
That is not quite correct. The core 2 machines will run 32 bit code just fine, otherwise *lots* of commercial software would break.
The four-way universal binary that Apple seems to ship is the optimal case because it includes 32 and 64 bit versions (as well as two PPC variants) but a two-way UB works too. I'm not sure if a web server benefits from running as 64bit binary.
The interesting question is if the dynamic linker picks the the 32 bit apache variant if the PHP module to be loaded dynamically is 32bit. That could be a problem. |
|
| Back to top |
|
 |
dcrombie
Joined: 29 Oct 2007 Posts: 5
|
Posted: Tue Oct 30, 2007 12:06 Post subject: |
|
|
| mickey79 wrote: | You are a rock star - to say the least.
Thank you so much for looking into this - I think a lot of us are waiting for the updated package. Can't thank you or appreciate you enough for all your efforts! |
I'll second that. Given that the Apple site links to PHP.net which then links here you'd think one of them would be throwing bucket-loads of cash your way  |
|
| Back to top |
|
 |
mickey79
Joined: 31 Jul 2007 Posts: 40
|
Posted: Tue Oct 30, 2007 13:43 Post subject: |
|
|
I'm going to attempt the Install again, and use the couple of Symbolic Links suggested here to see if it works.
I'll write back what happens. |
|
| Back to top |
|
 |
johanhenselmans
Joined: 18 Feb 2005 Posts: 8
|
Posted: Tue Oct 30, 2007 14:48 Post subject: Re: It's the CPU architecture as well |
|
|
| liyanage wrote: | | johanhenselmans wrote: | | The reason is that macbook-leopard demands 64 bits compiles. |
That is not quite correct. The core 2 machines will run 32 bit code just fine, otherwise *lots* of commercial software would break.
The four-way universal binary that Apple seems to ship is the optimal case because it includes 32 and 64 bit versions (as well as two PPC variants) but a two-way UB works too. I'm not sure if a web server benefits from running as 64bit binary.
The interesting question is if the dynamic linker picks the the 32 bit apache variant if the PHP module to be loaded dynamically is 32bit. That could be a problem. |
Of course you are right that 64-bit machines can run 32 bit code. But it might indeed be that running 32 bit inside Apache that runs 64 bit might be a problem.
I just checked http:
diomedea:libexec johan$ file /usr/sbin/httpd
/usr/sbin/httpd: Mach-O universal binary with 4 architectures
/usr/sbin/httpd (for architecture ppc7400): Mach-O executable ppc
/usr/sbin/httpd (for architecture ppc64): Mach-O 64-bit executable ppc64
/usr/sbin/httpd (for architecture i386): Mach-O executable i386
/usr/sbin/httpd (for architecture x86_64): Mach-O 64-bit executable x86_64
So there is a 64 bit apache available. If I could only see which one I am running. Activity Monitor will not show it, that will only show PPC or Intel.
lsof however did show:
httpd 17 root txt REG 14,16 88809472 17717203 /private/var/db/dyld/dyld_shared_cache_x86_64
The WebObjects module also is a fourway UB. So that might explain why I cannot start the current entropy-PHP in Apache2 |
|
| Back to top |
|
 |
mickey79
Joined: 31 Jul 2007 Posts: 40
|
Posted: Tue Oct 30, 2007 15:03 Post subject: |
|
|
I'm having a similar issue. I did try to give it a shot, but after installing the PHP package and creating the symbolic link (sudo ln -s /usr/local/php5/entropy-php.conf +entropy-php.conf) in (/etc/apache2/other/), I get this error when i test apache configuration (sudo apachectl configtest):
| Code: | | httpd: Syntax error on line 482 of /private/etc/apache2/httpd.conf: Syntax error on line 8 of /private/etc/apache2/other/+entropy-php.conf: Cannot load /usr/local/php5/libphp5.so into server: dlopen(/usr/local/php5/libphp5.so, 10): no suitable image found. Did find:\n\t/usr/local/php5/libphp5.so: no matching architecture in universal wrapper |
I had "Uncommented" the Load PHP Module line in the httpd.conf to disable the built-in PHP that was enabled earlier. |
|
| Back to top |
|
 |
liyanage Site Admin

Joined: 22 May 2003 Posts: 1104 Location: Zurich, Switzerland
|
Posted: Tue Oct 30, 2007 15:50 Post subject: Re: It's the CPU architecture as well |
|
|
| johanhenselmans wrote: | | But it might indeed be that running 32 bit inside Apache that runs 64 bit might be a problem. |
I did some more checking and you are right. Apple’s four-way Apache 2 universal binary runs as 64bit on hardware that supports it, and a 64bit host application can not load and run 32bit plug-in/module code.
My current PHP5 Apache 2 build will therefore only work for people who are using it on 32bit machines like the Core Duo (and not Core 2 Duo which are 64bit). That explains why it works for some people but not for others.
The problem I have now is that my current build setup does not permit me to build for one of the four targets: PPC 64bit. I need to figure out how to handle that. How many of you are using this on 64bit PPC machines?
Last edited by liyanage on Tue Oct 30, 2007 15:51; edited 1 time in total |
|
| Back to top |
|
 |
johanhenselmans
Joined: 18 Feb 2005 Posts: 8
|
Posted: Tue Oct 30, 2007 15:50 Post subject: |
|
|
| mickey79 wrote: | I'm having a similar issue. I did try to give it a shot, but after installing the PHP package and creating the symbolic link (sudo ln -s /usr/local/php5/entropy-php.conf +entropy-php.conf) in (/etc/apache2/other/), I get this error when i test apache configuration (sudo apachectl configtest):
| Code: | | httpd: Syntax error on line 482 of /private/etc/apache2/httpd.conf: Syntax error on line 8 of /private/etc/apache2/other/+entropy-php.conf: Cannot load /usr/local/php5/libphp5.so into server: dlopen(/usr/local/php5/libphp5.so, 10): no suitable image found. Did find:\n\t/usr/local/php5/libphp5.so: no matching architecture in universal wrapper |
I had "Uncommented" the Load PHP Module line in the httpd.conf to disable the built-in PHP that was enabled earlier. |
OK, I have found the temporary workaround. the reason some do not work has to do with the fact that php UB is not Fat enough: it does not contain a 64bit PPC nor a 64 bit i386, and that the apache2 version of entropy-php assumes a /usr/local/apache2/lib/libexpat.0.dylib to be available.
The procedure to get something running is:
-For G5 and Core2 machines: thin the httpd from a 64 bit UB to i386 or ppc UB
-Find some libexpat.0.dylib from somewhere
-Symlink this libexpat.0.dylib to /usr/local/apache2/lib
-Symlink entropy-php.conf into /etc/apache/other
Notice, this does move Apple binaries out of the way, that might be overwritten a next time. It will at least give you a working configuration until this is properly worked out with a four-way UB that includes a libexpat.0.dylib
Or, in shell lingo (this is for i3856 do with ppc for a G5 PPC):
cd /usr/sbin
mv httpd httpd.ub
lipo -info httpd.ub
lipo -thin i386 httpd.ub -output httpd.i386
lipo -info httpd.i386
ln -s httpd.i386 httpd
cd /etc/apache2/other
ln -s /usr/local/php5/entropy-php.conf .
locate libexpat
# in my case I found a libexpat in /opt/local/lib, from macports. Your mileage may vary. I also did a symlink from php ib to apache2 so everything would be in the same place
ln -s /usr/local/php5 /usr/local/apache2
cd /usr/local/apache2/lib
ln -s /opt/local/lib/libexpat.1.5.2.dylib .
ln -s /opt/local/lib/libexpat.0.dylib .
I only had to change in /usr/local/php5/lib/php.ini
open_short_tags = Off
to
open_short_tags = On
To get everything running. Hope this helps somebody. |
|
| Back to top |
|
 |
johanhenselmans
Joined: 18 Feb 2005 Posts: 8
|
Posted: Tue Oct 30, 2007 16:04 Post subject: Re: It's the CPU architecture as well |
|
|
| liyanage wrote: | | johanhenselmans wrote: | | But it might indeed be that running 32 bit inside Apache that runs 64 bit might be a problem. |
I did some more checking and you are right. Apple’s four-way Apache 2 universal binary runs as 64bit on hardware that supports it, and a 64bit host application can not load and run 32bit plug-in/module code.
My current PHP5 Apache 2 build will therefore only work for people who are using it on 32bit machines like the Core Duo (and not Core 2 Duo which are 64bit). That explains why it works for some people but not for others.
The problem I have now is that my current build setup does not permit me to build for one of the four targets: PPC 64bit. I need to figure out how to handle that. How many of you are using this on 64bit PPC machines? |
Wouldn't you be able to cross compile? I assume that is possible now for the four platforms in Leopard, as it was already possible for the 2 platforms in Tiger. |
|
| Back to top |
|
 |
mickey79
Joined: 31 Jul 2007 Posts: 40
|
Posted: Tue Oct 30, 2007 16:25 Post subject: Re: It's the CPU architecture as well |
|
|
| liyanage wrote: | | The problem I have now is that my current build setup does not permit me to build for one of the four targets: PPC 64bit. I need to figure out how to handle that. How many of you are using this on 64bit PPC machines? |
I have a PowerMac G5 that I bought 4 years ago. It's not Intel, and as far as I know, it's not 64bit, but 32bit. This is what the System Profiler says:
| Quote: |
Machine Model: Power Mac G5
CPU Type: PowerPC G5 (2.2)
Number Of CPUs: 2
CPU Speed: 2 GHz
L2 Cache (per CPU): 512 KB
Memory: 512 MB
Bus Speed: 1 GHz
Boot ROM Version: 5.1.8f7
|
But the php 5.2.4 package still doesn't work on my PowerMac G5.
@johanhenselmans: I want to give your method & instructions a shot. One thing I forgot to mention earlier was, I did actually mkdir usr/local/apache2/lib and created a symbolic link to /usr/lib/libexpat.1.5.0.dylib but not to libexpat.0.dylib
Let me give it a short and post feedback! |
|
| Back to top |
|
 |
liyanage Site Admin

Joined: 22 May 2003 Posts: 1104 Location: Zurich, Switzerland
|
Posted: Tue Oct 30, 2007 16:37 Post subject: Re: It's the CPU architecture as well |
|
|
| johanhenselmans wrote: | | Wouldn't you be able to cross compile? I assume that is possible now for the four platforms in Leopard, as it was already possible for the 2 platforms in Tiger. |
The toolchain itself cross-compiles fine:
| Code: | echo 'int main() {}' > test.c
for arch in i386 x86_64 ppc7400 ppc64; do
CFLAGS="-arch $arch" make -B test
file test
./test
done |
Output:
| Code: | cc -arch i386 test.c -o test
test: Mach-O executable i386
cc -arch x86_64 test.c -o test
test: Mach-O 64-bit executable x86_64
cc -arch ppc7400 test.c -o test
test: Mach-O executable ppc
cc -arch ppc64 test.c -o test
test: Mach-O 64-bit executable ppc64
test-crosscompile.sh: line 5: ./test: Bad CPU type in executable |
Also as four-way UB:
| Code: | cc -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64 test.c -o test
test: Mach-O universal binary with 4 architectures
test (for architecture i386): Mach-O executable i386
test (for architecture x86_64): Mach-O 64-bit executable x86_64
test (for architecture ppc7400): Mach-O executable ppc
test (for architecture ppc64): Mach-O 64-bit executable ppc64 |
The problem is that the “configure” scripts of the large open source packages check if the produced binaries are executable and the build fails if that check fails.
As shown by the output above, my particular machine can execute three of the four binary formats, one of which using with the help of Rosetta. That was a neat trick I used for my current two-way UB PHP5 package until now.
I need to dig into the cross-compile support of GNU autoconf a bit and figure out if it can be used. The big problem is that some configure scripts are just not written in a way that works with a cross-compiler (i.e. they make use of AC_TRY_RUN without a default or use other similar macros)
Here is an example from libcurl:
| Code: | $ CFLAGS="-arch ppc64" ./configure --host=ppc64
...
checking for "/dev/urandom"... configure: error: cannot check for file existence when cross compiling |
This one can actually be fixed with an explicit configure argument, but others can’t |
|
| Back to top |
|
 |
mickey79
Joined: 31 Jul 2007 Posts: 40
|
Posted: Tue Oct 30, 2007 17:12 Post subject: |
|
|
Ok, I followed your instructions & shell commands to the tee. Once I was done with everything, ran sudo apachectl configtest, this is what I get:
| Code: | /usr/sbin/apachectl: line 102: /usr/sbin/httpd: Bad CPU type in executable
|
Earlier on during the shell commands, these are some of the results I got:
sudo lipo -info httpd.ub gave me:
| Code: | | Architectures in the fat file: httpd.ub are: ppc7400 (cputype (16777234) cpusubtype (-2147483648)) i386 (cputype (16777223) cpusubtype (-2147483645)) |
lipo -info httpd.i386 gave me:
| Code: | | Non-fat file: httpd.i386 is architecture: i386 |
One IMPORTANT thing I did want to mention is that I could not find libexpat.0.dylib anywhere on my leopard system. I did make symbolic links to these libexpat's that I found in my /usr/lib/:
libexpat.1.5.0.dylib
libexpat.1.dylib
libexpat.dylib
libexpat.la
But i didn't find libexpat.0.dylib anywhere.
Not sure where to go from here, but I hope this information helps.
| johanhenselmans wrote: | Or, in shell lingo (this is for i3856 do with ppc for a G5 PPC):
cd /usr/sbin
mv httpd httpd.ub
lipo -info httpd.ub
lipo -thin i386 httpd.ub -output httpd.i386
lipo -info httpd.i386
ln -s httpd.i386 httpd
cd /etc/apache2/other
ln -s /usr/local/php5/entropy-php.conf .
locate libexpat
# in my case I found a libexpat in /opt/local/lib, from macports. Your mileage may vary. I also did a symlink from php ib to apache2 so everything would be in the same place
ln -s /usr/local/php5 /usr/local/apache2
cd /usr/local/apache2/lib
ln -s /opt/local/lib/libexpat.1.5.2.dylib .
ln -s /opt/local/lib/libexpat.0.dylib .
|
|
|
| Back to top |
|
 |
|