Apache安裝

cd /usr/ports/www/apache22
make config install clean

MySQL安裝

cd /usr/ports/databases/mysql51-server/
make -DWITH_CHARSET=utf-8 install clean

PHP安裝

cd /usr/ports/lang/php5
make config install clean #除了apache/debug以外都選,這邊只安裝了PHP主程式

PHP Extensions安裝

cd /usr/ports/lang/php5-extensions/
make config install clean
#除了預設選取的,至少還要選filter/mysql/gd/gettext/iconv/openssl

設定

首先先在/etc/rc.conf中加入

apache22_enable="YES"
mysql_enable="YES"

接著設定PHP的設定檔

cd /usr/local/etc
cp php.ini-recommended php.ini
#也可以用php.ini-development

啟動MySQL

/usr/local/etc/rc.d/mysql-server start

變更密碼

mysqladmin -u root -p password '新密碼'

檢查apache設定檔是否有問題

apachectl -t

最後再啟動apache22

/usr/local/etc/rc.d/apache22 start
Categories: FreeBSD