libphp5.so: mach-o, but wrong architecture

で、

Mar 11 14:38:32 macminikume org.apache.httpd[77745]: httpd: Syntax error on line 160 of /private/etc/apache2/httpd.conf: Cannot load /opt/local/apache2/modules/libphp5.so into server: dlopen(/opt/local/apache2/modules/libphp5.so, 10): no suitable image found.  Did find:\n\t/opt/local/apache2/modules/libphp5.so: mach-o, but wrong architecture
だ。
アーキテクチャーが、違う、のね。はいはい。
ググってみると…キーワードはどーする?
エラーメッセージの一部の文字列をそのままキーワードにする…らんぼー
うへー、2年前かよ。
まぁ、いくつかコマンドを実行してみるか。
まず、すんなり稼働した PPC マシン Leopard … G4。
file /opt/local/bin/php
/opt/local/bin/php: Mach-O executable ppc
lipo -info /opt/local/bin/php
Non-fat file: /opt/local/bin/php is architecture: ppc7400
file /usr/sbin/httpd 
/usr/sbin/httpd: Mach-O fat file with 4 architectures
lipo -info /usr/sbin/httpd
Architectures in the fat file: /usr/sbin/httpd are: ppc7400 ppc64 i386 x86_64
そして、ダメダメだった Intel Leopard マシン。
file /opt/local/bin/php
/opt/local/bin/php: Mach-O executable i386
lipo -info /opt/local/bin/php
Non-fat file: /opt/local/bin/php is architecture: i386
file /usr/sbin/httpd
/usr/sbin/httpd: Mach-O fat file with 4 architectures
lipo -info /usr/sbin/httpd
Architectures in the fat file: /usr/sbin/httpd are: ppc7400 ppc64 i386 x86_64
そんで、Intel Snow Leopard なら…
file /opt/local/bin/php
/opt/local/bin/php: Mach-O 64-bit executable
lipo -info /opt/local/bin/php
Non-fat file: /opt/local/bin/php is architecture: x86_64
file /usr/sbin/httpd
/usr/sbin/httpd: Mach-O fat file with 3 architectures
lipo -info /usr/sbin/httpd
Architectures in the fat file: /usr/sbin/httpd are: x86_64 i386 ppc7400
Apple が導入した apache2 は、ふぁっとばいなり〜
導入された PHP が ppc ならば、PPC マシン…ppc7400…たぶんG4…であれば、問題なく動いた訳だな。
でもって、導入された PHP が x86_64 ならば、Intel マシン Snow Leopard で、問題なく動いた訳だな。
ふむ。
要するに、PHP と httpd がどのアーキテクチャーで稼働するようになっているのか、食い違ってはダメって事だ。
後は、ふぁっとばいなり〜をダイエットさせちまえっ…らんぼー
cd /usr/sbin/
cp -p httpd httpd_fat_file_with_4_architectures
lipo /usr/sbin/httpd -thin i386 -output /usr/sbin/httpd
or
lipo /usr/sbin/httpd -thin ppc7400 -output /usr/sbin/httpd
ふぅ
これで、動くようになりましたぜ。
phpMyAdmin を使っても、
mcrypt 拡張をロードできません。PHP の設定を確認してください
とは、表示されなくなった。
ちなみに、MacPortsで導入した apache2 の元では、PHP は問題なく動いていた。
後付けで、Intel マシン Leopard の場合だけど、
lipo -info /opt/local/apache2/bin/httpd 
Non-fat file: /opt/local/apache2/bin/httpd is architecture: i386
ということだった。i386 で共通だ。

Comments are closed