OS X Mountain Lion に Apache と php がプリインストールされているので、MAMPをインストールせずにサーバーをローカルで実行するのに十分だと私が考える手順は次のとおりです(重複してインストールされます)。
LoadModule php5_module libexec/apache2/libphp5.soの行のコメントを外し/etc/apache2/httpd.confます。- 適切な を追加します
/etc/apache2/users/calaf.conf。 - 上記の php の例を ~/Sites/introductory-example.html に保存します (修正)
sudo apachectl start(または)を実行してApache を再起動sudo apachectl restartします。<html><head><title>Example</title></head><body><php? echo "Hi"; ?></body></html>(正確には、これを含む) ファイルを2 回保存します~(whoami)/Sites/introductory-example.html。
どちらかhttp://localhost/introductory-example.htmlまたは を指すとhttp://localhost/~calaf/introductory-example.html、次の 2 つの機能を備えたページが表示されると思います。
- ページのタイトルは「例」です。
- ページの本文は「こんにちは」です。
inを見てもinintroductory-example.htmlを見ても、1 つ目 (タイトルは正しい) が表示されますが、2 つ目 (本文は空) は表示されません。/Library/WebServer/Documents~/Sites/