PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Windows システムへのインストール> <Mac OS X へのインストール
Last updated: Fri, 16 May 2008

view this page in

Mac OS X クライアント用にコンパイルする

以下の手順は、PHP モジュールを Mac OS X に付属する Apache Web サーバ用に インストールする際の手引きとなるものです。本バージョンには、MySQL および PostgreSQL データベースのサポートが含まれます。以下の手引きは、 » Marc Liyanage 氏に提供して頂いたものです。

警告

以下の手順を行う際は、Apache Web サーバをダウンさせる可能性 があるので注意してください

以下のインストール手順を実行してください。

  1. ターミナルウインドウをオープンします。
  2. wget http://www.diax.ch/users/liyanage/software/macosx/libphp4.so.gz とし、ダウンロード完了を待ちます。
  3. gunzip libphp4.so.gz と入力します。
  4. sudo apxs -i -a -n php4 libphp4.so と入力します。
  5. 次に sudo open -a TextEdit /etc/httpd/httpd.conf と 入力すると、TextEdit により Web サーバの設定ファイルがオープンされます。ファイルの 末尾の方にある以下の 2 行を探してください(検索コマンドを使用しましょう。)

    #AddType application/x-httpd-php .php 
    #AddType application/x-httpd-php-source .phps
    
    ハッシュ記号 (#) を削除して、ファイルを保存し、 TextEdit を終了させます。

  6. 最後に、Web サーバを再起動させます。 sudo apachectlgraceful と入力してください。

この時点で PHP が動作しているはずです。test.php という 名前のファイルを Sites フォルダに 作成してください。このファイルを編集し、<?php phpinfo() ?> と書いてください。

次に、127.0.0.1/~あなたのユーザ名/test.php を Web ブラウザで オープンしてください。ステータステーブルが表示され、インストールした PHP モジュールに関する情報を見ることができるはずです。



add a note add a note User Contributed Notes
Mac OS X クライアント用にコンパイルする
mdoyle at cooperationireland dot org
08-Apr-2008 12:54
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.
rahul
09-May-2007 05:54
if `wget` isn't installed or not in your path use `curl -O` instead.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites