苗栗縣大湖鄉大南國民小學全球資訊網路 (FreeBSD) 架站日誌
本文件持續編修中,若有發現謬誤或侵犯您的權益,
敬請批評指教。
Apache-1.3.20+PHP-4.0.5 之安裝與設定
(含imap)
[ 前言 | 下載 | 編譯與安裝 | 設定 | 測試 | Home ]
- 前言:
addgroup www (gid < 100)
adduser www (uid < 100)
lab.mlc.edu.tw是我的網域名稱,www.lab.mlc.edu.tw是我的主機名稱,您若參考本文件操作時,應將此資料做相對修改為您的網域名稱與主機名稱,才不會出差錯。
- 下載:
除了imap之外,其餘均可至交通大學之mirror站臺下載。您也可以至本站檔案伺服器尋找。
cd /usr/local/src 將檔案下載於此,並在這裡解壓縮與編譯安裝;您的編譯路徑若與本文件相異,請自行修改,照抄時,會出錯。
tar zxvf imap-4.7c2.tar.Z
tar zxvf php-4.0.5.tar.gz
tar zxvf apache_1.3.20.tar.Z
- 編譯與安裝:
- imap之編譯與安裝(此處以安裝於FreeBSD上為例,其他OS系統,請參閱Makefile)
cd imap-4.7c
make bsf
cp imapd/imapd /usr/local/libexec/
ln -s c-client/ include
ln -s c-client/ lib
- apache之初始configure
cd ../../apache_1.3.20
./configure --prefix=/usr/local/apache
- php之編譯與安裝(含入imap模組)
cd ../php-4.0.5
./configure \
--prefix=/usr/local/php \
--with-apache=../apache_1.3.20 \
--with-gd=/usr/local/ \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local \
--with-imap=../imap-4.7c \
--with-mysql=/usr/local/mysql \
--enable-trans-sid \
--enable-ftp
gmake
gmake install
cp php.ini-dist /usr/local/lib/php.ini
- --prefix=/usr/local/php
install architecture-independent files in PREFIX
- --with-apache=/usr/local/src/apache_1.3.20
Build Apache module. DIR is the top-level Apache build directory, defaults to /usr/local/etc/httpd.
- --with-gd=/usr/local
Include GD support (DIR is GD's install dir). Set DIR to shared to build as a dl, or shared,DIR to build as a dl and still specify DIR.
- --with-jpeg-dir=/usr/local
GD: jpeg dir for gd-1.8+
- --with-png-dir=/usr/local
png dir for pdflib 3.x
- --with-imap=/usr/local/include/imap
Include IMAP support. DIR is the IMAP include and c-client.a directory.
- --with-mysql=/usr/local/mysql
Include MySQL support. DIR is the MySQL base directory. If unspecified, the bundled MySQL library will be used.
- --enable-trans-sid
Enable transparent session id propagation
- --enable-ftp
Enable FTP support
- apache之編譯與安裝(含入php模組)
cd ../apache_1.3.20
./configure \
--prefix=/usr/local/apache \
--enable-module=most \
--enable-shared=max \
--enable-suexec \
--suexec-caller=www \
--activate-module=src/modules/php4/libphp4.a
gmake
gmake install
- --prefix=/usr/local/apache
install architecture-independent files in PREFIX
- --enable-module=most
enable a particular Module named 'NAME'
- --enable-shared=max
enable build of Module named 'NAME' as a DSO
- --enable-suexec
enable the suEXEC feature
- --suexec-caller=www
set the suEXEC username of the allowed caller
- --activate-module=src/modules/php4/libphp4.a
on-the-fly activate existing 3rd-party Module
- ./configure -h
更詳細的編譯選項。
- 設定:
- 啟動imap功能:
vi /etc/inetd.conf
......
kill -HUP `cat /var/run/inetd.pid`
- CGI:
cd /usr/local/apache/cgi-bin
chmod +x *
- httpd.conf:
vi conf/httpd.conf
User www
Group www
ServerAdmin admin@lab.mlc.edu.tw
ServerName www.lab.mlc.edu.tw
DirectoryIndex index.html index.htm index.php index.php3 index.shtml
AddType application/x-httpd-php .php .php3
AddType application/x-httpd-php-source .phps
- 設定開機時就啟動Apache
vi /etc/rc.local
加入一行
/usr/local/apache/bin/apachectl start
- PHP
cd /usr/local/apache/htdocs
vi phpinfo.php
建立一行:
<?phpinfo()?>
- 啟動:
/usr/local/apache/bin/apachectl start
Miaoli Da-Nan Elementary School.
No. 15 Da-Nan Village, Da-Hwu County, Miaoli, Taiwan, R.O.C.
本文件允許在不變更文件內容的前提下刊登或連結在任何型態的媒體中。