來自 http://www.midgard-project.org/download/binaries 的 RPMS 目前不包括 PostgreSQL 支援,所以你要從原始碼 tar.gz 檔安裝。
下載 Midgard 原始碼 tar.gz 檔,閱讀 INSTALL.REDHAT 檔—
bash# cd midgard-lib-1.4beta6 bash# ./configure --prefix=/usr/local --with-mysql=/usr/local --includedir=/usr/include/mysql --with-midgard=/usr/local --with-pgsql=/var/lib/pgsql --includedir=/usr/include/pgsql bash# make bash# make install bash# ldconfig -v | grep -i midga 拷貝檟頭檔,以防 make install 不這樣做… bash# cp *.h /usr/local/include bash# cd ../mod_midgard-1.4beta5c bash# ./configure --prefix=/usr/local --with-mysql=/usr/local --includedir=/usr/include/mysql --with-midgard=/usr --with-pgsql=/var/lib/pgsql --includedir=/usr/include/pgsql bash# make bash# make install # 修改 apache 設定為 /usr/…… #modify apache line to correct /usr/..... bash# vi /etc/httpd/conf/httpd.conf (或在 /etc/apache/httpd.conf) bash# /etc/init.d/apache restart # 耍重新啟動 apache!!! bash# cd ../midgard-php-1.4beta6 bash# ./configure '--with-apxs' '--with-mysql' '--with-pgsql' '--with-midgard' --prefix=/usr/local --with-midgard=/usr/local bash# gvim Makefile 在 INCLUDE 變數中加上 -I/usr/include/pgsql。 也要如下在 $(APXS) 指令中加上 $(INCLUDE)— libphp3.so: mod_php3.c libmodphp3-so.a pcrelib/libpcre.a midgard/libphpmidgard.a -@test -f ./mod_php3.c || test -L ./mod_php3.c || $(LN_S) $(srcdir)/mod_php3.c ./mod_php3.c -@test -f ./mod_php3.c || test -h ./mod_php3.c || $(LN_S) $(srcdir)/mod_php3.c ./mod_php3.c $(APXS) -c -o libphp3.so -I$(srcdir) $(INCLUDE) -I. -I/usr/local/include -I/usr/lib/glib/include -Wl,'-rpath /usr/local/lib' ./mod_php3.c libmodphp3-so.a $(APXS_LDFLAGS) bash# make bash# make install # 修改 apache 設定為 /usr/…… # 加上如下數行— LoadModule php4_module modules/libphp4.so AddModule mod_php4.c LoadModule php4_module lib/apache/libphp4.so <IfModule mod_php4.c> AddType application/x-httpd-php4 .php4 AddType application/x-httpd-php4 .php AddType application/x-httpd-php4-source .phps AddType application/x-httpd-php .php </IfModule> bash# vi /etc/httpd/conf/httpd.conf (或在 /etc/apache/httpd.conf) bash# /etc/init.d/apache restart # 要重新啟動 apache!!!
要測試安裝是否成功請這樣做— 在你的文件根目錄中建立一個檔案。我通常稱它為 info.php,並在其間加上一行︰
<?phpinfo()?>
在你的瀏覽器中載入︰http://localhost/info.php
你會見到一頁漂亮的掫要,列出你的設定中所有資料。 你大概不會把這檔案放在在生產用的伺服器中,但為了開發時除錯和一般資料, 它會很方便。
你可能要在 ftp://ftp.deva.net/pub/sources/crypto/rsaref20.1996.tar.Z 取行 RSA 套裝軟件以啟用 SSL 加密。也請看看 Linux 光碟的 OpenSSL http://www.openssl.org。
如果你不想啟動 SSL(或你遇到困難),下載原始碼 Apache-Midgard RPM 和修改 *.spec 檔和刪去 SSL,再重見 RPM。