หลังจากก่อนหน้านี้ได้ทำการติดตั้ง Apache เรียบร้อยแล้ว ที่ขาดไม่ได้คงเป็น php คราวนี้มาลองติดตั้งกันดีกว่า
อันดับแรก ต้องติดตั้ง library ที่จำเป็นก่อน กรณีของ FreeBSD ก็ตามนี้
- CURL library : /usr/ports/ftp/curl
- libiconv : /usr/ports/converters/libiconv
- JPEG library : /usr/ports/graphics/jpeg
- PNG library : /usr/ports/graphics/png
- cpdflib library : /usr/ports/print/clibpdf
- Freetype 2 library : /usr/ports/print/freetype2
หลังจากติดตั้ง library ต่างๆ เรียบร้อยแล้ว ซึ่ง เป็น package ที่จำเป็นของ GD
ต่อจากนั้น compile php ต่อ
./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql \
--with-zlib \
--with-bz2 \
--with-gd \
--enable-gd \
--enable-gd-native-ttf \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local \
--with-ttf \
--with-freetype-dir=/usr/local \
--with-iconv=/usr/local \
--with-curl=/usr/local \
--enable-track-vars \
--with-gettext \
--enable-trans-id \
--with-cpdflib=/usr/local \
--enable-mbstring \
--with-openssl
หลังจากนั้นก็ make && make install ติดตั้งต่อไป
ต่อจากนั้นไปแก้ไข httpd.conf ของ apache
เพิ่ม
LoadModule php4_module modules/libphp4.soAddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
ต่อจากนั้น
cp php.ini-recommended /etc/php.ini
เพื่อกำหนดค่าของ php.ini
อ้างอิง









August 16th, 2007 at 1:56 pm
[...] http://www.mr-san.com/mod-php-freebsd/ This entry was posted on Thursday, August 16th, 2007 at 2:34 pm and is categorized in Linux. You [...]