With OSX 10.5, the bundled version is up to date but didn't come with the modules I needed (notably I wanted the pgsql database extension).
Getting this to work was quite simple in the end, what made it difficult is the build-options for Apache. After searching on google, I found instructions to re-build apache with the following options:
./configure --enable-layout=Darwin --enable-mods-shared=all
(Step 1: download the latest Apache2.2 source files,
Step 2: extract the tarball
Step 3: ./configure --enable-layout=Darwin --enable-mods-shared=all
Step 4: make all
Step 5: sudo make install)
Without this step, when I rebuilt PHP either directly with the source from the PHP.net site or using MacPorts I was getting an error about the wrong architecture like this one:
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
After re-building and Apache with the configuration above and restarting it, everything worked again and I can now use PostgreSQL from within PHP on my MacBook Pro.
MacOS X クライアント上の Apache 用のインストール
以下の手順は、MacOS X に含まれる Apache ウェブサーバ用の PHP モジュールを、MacOS X の GUI を用いてインストールするための手引きです。 このバージョンには MySQL、PostgreSQL そして iODBC データベースのサポートが含まれ、 また cURL、GD、PDFLib、LDAP などのサポートも含まれます。これらの手引きは » Marc Liyanage 氏に提供していただいたものです。
ここから先に進む前に、自分が何をしようとしているのかをきちんと把握しておきましょう! さもないと、インストールされている Apache が取り返しの付かない状態になってしまうかもしれません。
注意: これらの手順は、Apple から出荷されたときのままの状態の Apache ウェブサーバに対してのみ動作するものです。 Apache をリビルドしたりアップグレードしたりしている場合は、 自分で PHP モジュールをビルドしなければなりません。
インストールするには、
-
Apache 1.3 の場合は
http://www2.entropy.ch/download/entropy-php-5.2.4-1.tar.gzをダウンロードします。 -
Apache 2 の場合は
wget http://www2.entropy.ch/download/entropy-php-5.2.4-1-apache2.tar.gzをダウンロードします。 - .tar.gz を展開します。このとき StuffIt Expander を使ってはいけません。 Apple の BOMArchiveHelper か、あるいはコマンドラインを使用しましょう。
- インストーラパッケージをダブルクリックし、 インストーラの指示に従います。
これだけです! この時点で PHP が動作しているはずです。動作確認をするには、 まず test.php という 名前のファイルをホームディレクトリの Sites フォルダに作成してください。そして、このファイルを編集し、 <?php phpinfo() ?> と書いてください。
次に、127.0.0.1/~あなたのユーザ名/test.php をウェブブラウザで開いてください。ステータステーブルが表示され、 インストールした PHP モジュールに関する情報を見ることができるはずです。
MacOS X クライアント上の Apache 用のインストール
07-Apr-2008 05:54
