資料來源:

MySQL資料庫:
www.mysql.com

php3語法:
www.php.net

Linuxer雜誌
天充文化

 

 

 

 

 

 

88/10/1初稿
88/11/7修正
88/12/13補充
林朝敏

 

 

檔案取得:
新營國小ftp站

 

安裝php3+MySQL+Sendmail

Linuxer雜誌八月份中刊了一篇安裝 focalmail(一套免費的web-email) 的方法,我想在國小中架設這種簡易使用email的方式,會對小朋友有很大的幫助!但沒想到竟是一個月時間的磨難!

從下載php3各版本原始程式、MySQL原始程式、rpm版本,編譯程式,修改apache 的設定檔。但由於安裝系統時大多以rpm包裝方式安裝,所以不敢全部改成以程式碼重作,以此耗掉好多時間,還是一無所得。

RPM包裝安裝法請看下述後記說明!

最後在php站中一篇faq的說明中找到答案(以下記錄不是很完整請見諒)---

3.3 I installed PHP using RPMS, but it doesn't compile with the databasesupport I need! What's going on here? 

Due to the way PHP is currently built, it is not easy to build a complete flexible PHP RPM. This issue will be addressed in PHP4. For PHP, we currently suggest you use the mechanism described in the INSTALL.REDHAT file in the PHP distribution. If you insist on using an RPM version of PHP, read on... Currently the RPM packagers are setting up the RPMS to install without database support to simplify installations AND because RPMS use /usr/ instead of the standard /usr/local/ directory for files. You need to tell the RPM spec file which databases to support and the location of the top-level of your database server.
This example will explain the process of adding support for the popular MySQL database server, using the mod installation for Apache. Of course all of this information can be adjusted for any database server that PHP supports. I will assume you installed MySQL and Apache completely with RPMS for this example as well. 

RedHat6.0 中的apache 已預先支援並編譯了 mod-php3 模組,只要安裝mod-php3.0.7.rpm 就可以了。

修改 /etc/httpd/conf/httpd.conf 、 srm.conf,檢查或加入以下文字:(把前方#拿掉)

LoadModule phpx_module /<path>/libphpx.so
AddModule mod_phpx.c

AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .phps

到此就可以在apache上使用php3語法了。但要加上MySQL、Sendmail的模組,必須再重做編譯的動作。

先安裝MySQL-3.22.*.i386.RPM  、  MySQL-client-*.RPM 、MySQL-devel-3.22*.RPM  、  (寄信軟體)imap-4.5-*.src.RPM    、 imap-4.5*i386.RPM  

安裝 php 需用到sendmail 的 include 檔案,先編譯imap-4.5:

#pwd
/usr/src/redhat/SOURCES
#tar xzvf imap-4.5.3.tar.z
#make sl5                  (會出現錯誤,我也不知道如何做,不管,他會產生一個c-client 的目錄,或試以 #make slx )
#mkdir /usr/include/imap
#cp /usr/src/redhat/SOURCES/imap-4.5/c-client/* /usr/include/imap/.
#cp /usr/src/redhat/SOURCES/imap-4.5/c-client/c-clent.a  /usr/lib/.
#cp /usr/src/redhat/SOURCES/imap-4.5/c-client/c-clent.a  /usr/lib/libc-client.a

 

移除先前所裝的 mod_php3
# rpm -e mod_php3

Then get the source rpm and INSTALL it, NOT --rebuild
# rpm -Uvh mod_php3-3.0.7-2.src.rpm
修改檔案 /usr/src/redhat/SPECS/mod_php3.spec 編譯參數設定加入對MySQL 、 sendMail 的支援.
要使用 MySQL 需加入 --with-mysql [=/usr] \
檔案內容修改如下:

./configure --prefix=/usr \
--with-apxs=/usr/sbin/apxs \
--with-config-file-path=/usr/lib \
--enable-debug=no \
--enable-safe-mode \
--with-exec-dir=/usr/bin \
--with-mysql \
--with-imap \
--with-system-regex

重新編譯 mod_php3:
# rpm -bb /usr/src/redhat/SPECS/mod_php3.spec 
安裝
# rpm -ivh /usr/src/redhat/RPMS/i386/mod_php3-3.0.7-2.i386.rpm

重新啟動 Apache。好了,大功告成!
# /etc/rc.d/init.d/httpd stop
# /etct/rc.d/init.d/httpd start

這一篇就講到這兒,再看下一篇,架設web-email(focalmail).

ps.在編譯過程中可能會出現錯誤訊息,如找不到 freetype.c 等,請準備好你的redhat 光碟,安裝 freetype-devel*.RPM 、gd-devel* 等。

 

後記:(10/7)

提供一篇內容給你參考(英文文件 INSTALL.REDHAT)
你如果覺得上述方法太麻煩了,你可以試著以別人編好的RPM檔來安裝,會方便一些,我在 ftp://sy3es.tnc.edu.tw/pub/linux/php 中放了一份,你可以依照說明檔安裝。我也試著重新安裝,真的太方便了。(12/13)