FreeBSD9.2-RELEASE


PHP5.5.9をインストール

準備

・Perlへのパスを修正
# vi /usr/local/apache2/bin/apxs
#!/usr/local/bin/perl -w ←修正
・libxml2インストール
# cd /usr/ports/texproc/libxml2
# make install clean

PHP ソースからインストール

# cd /usr/local/src(ソースのある場所)
# tar zxvf php-5.5.9.tar.gz
# cd php-5.5.9
# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --enable-mbstring --enable-mbregex --with-pgsql
# make
# make install | tee /var/log/install_log_php

Apacheの設定

# vi /usr/local/apache2/conf/httpd.conf
<IfModule dir_module> 
    DirectoryIndex index.html index.htm index.cgi
    ↓
    DirectoryIndex index.html index.htm index.cgi index.php ←変更(index.phpを許可)
</IfModule> 

<IfModule mime_module>
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php ←追加(.phpファイルを使えるようにする)
</IfModule>
確認

# echo "<?php phpinfo(); ?>" > /usr/local/apache2/htdocs/info.php
ブラウザで192.168.1.51/info.php
正常に表示できた

ユーザディレクトリの設定

# vi /usr/local/apache2/conf/httpd.conf
Include etc/apache22/extra/httpd-userdir.conf ←コメント解除(ユーザーディレクティブ設定)
・192.168.1.51/~yamasakiでアクセスできるようになる