Octopress 部落格

一個靜態網站的部落格框架

PHP 在 FreeBSD 上的安裝步驟

PHP 在 FreeBSD 上安裝的步驟: (使用 Configure 方式安裝) :

1. Download php-5.2.6.tar.gz

2. tar xzvf php-5.2.6.tar.gz

3. cd php-5.2.6

4. /bin/sh ../php.configure.sh (php.configure.sh 要先將configure的參數先設定好)

5. make install

6. cp php.ini-dist /usr/local/php/lib/php.ini

7. 設定 /usr/local/php/lib/php.ini

(1) include_path=”.:/usr/local/php”

(2) register_globals=off

(3) short_open_tag = On

8. 設定 httpd.conf

(1) LoadModule php5_module libexec/libphp5.so

(2) AddType application/x-httpd-php .php

(3) DirectoryIndex 後面加上 index.php

9. 重新啟動 Apache Server

/usr/local/apache2/bin/apachectl restart

(PS: DSO版(*.so)檔案, 放在 /usr/local/apache2/modules

10. 測試 php

/usr/local/php/bin/php -i

如果有出現php的參數設定,就表示成功了~~



以下列出為參考其他人使用的PHP configure 的參數設定: (php.configure.sh)

#!/bin/bash
./configure –prefix=/usr/local/php –mandir=/usr/local/php/man –infodir=/usr/local/php/info –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql=/usr/local/mysql –with-curl=/usr/lib –with-zlib-dir=/usr/lib –with-freetype-dir=/usr/lib –enable-zend-multibyte –enable-ftp –enable-mbstring –with-iconv –enable-gd-native-ttf –with-openssl –with-mysql –with-zlib –with-gd –enable-mbstring –enable-libxml –with-regex=php



(PS:apxs 為 Apache configure 時要有下 –enable-module=so 的參數)

其他參數如:

–enable-fastcgi

–enable-mssql

–enable-pgsql

–enable-sqlite-utf8