歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux資訊 >> Linux文化 >> Apache + PHP 4.0 + Sybase 安裝文檔

Apache + PHP 4.0 + Sybase 安裝文檔

日期:2017/2/27 12:14:59   编辑:Linux文化


[目的]

使用linux 構架web服務器, 連接小型機上的Sybase數據庫。我們在Sybase服務器上安裝了一個實驗的數據庫,數據庫名為test, test中有一個表是Province, 字段有Province_id, Province。

Province_id Province
----------- --------
110     北京市
120     天津市

[相關軟件]

Redhat 7.0 Linux
Apache 1.3.12
PHP 4.0.0
Sybase 11.9.2 for Linux /Intel

[安裝過程]

1。 安裝RED HAT 7.0

我選擇了Customer 全安裝,因為安裝Sybase時,要有X環境。

安裝完成後,建立一個工作目錄/home/workshop,上傳所有安裝文件

sybase-common-11.9.2-3.i386.rpm
sybase-openclient-11.1.1-3.i386.rpm
apache_1.3.12.tar.gz
php-4.0.0.tar.gz

2. 安裝Sybase的open-client.

在/home/workshop目錄下:

host_name# rpm -hiv sybase-common-11.9.2-3.i386.rpm
host_name# rpm -hiv sybase-openclient-11.1.1-3.i386.rpm

默認的安裝路徑為/opt/sybase-11.9.2/ , 並且有了一個sybase用戶,用passwd sybase命令更改sybase用戶的密碼。
現在,用sybase登陸到你的linux計算機上,計算機將顯示

------------------------------------------------------------------------
C-Shell users:

source .cshrc

=> Start 'srvbuild'

srvbuild

Documentation towards any Sybase product can be found on our Dynaweb
pages accessible from our World Wide Web site:

<http://www.sybase.com>
<http://sybooks.sybase.com/dynaweb>

We would like you to register your installation and find more
information about this Sybase Adaptive Server Enterprise release
for Linux available from:

<http://linux.sybase.com>

Enjoy this Sybase Adaptive Enterprise Server installation !

bash-2.04$
------------------------------------------------------------------------

這時,啟動Xwindow環境,


bash-2.04$startx

在Xwindow環境中,運行/opt/sybase-11.9.2/bin/dsedit, 選擇Add New Server Entry,

Server Name : devhost (可隨意寫)
再選擇add new network transport ,
transport type : TCP
host name : 211.5.6.50 (服務器的ip)
port Number: 5000 (Sybase服務器監聽的端口)

完成後,確定退出。
可用isql命令檢驗是否連接成功,

bash-2.04$isql -Usa -Sdevhost
輸入密碼後,出現
1> use test
2> go
1> select * from test.Province
2> go
Province_id Province
----------- --------
110     北京市
120     天津市
130     河北省
140     山西省
150     內蒙古
210     遼寧省
220     吉林省
230     黑龍江
... ...
610     陝西省
620     甘肅省
630     青海省
640     寧夏區
650     新疆區
660     西藏區
(28 rows affected)
1>
啊,現在openclient就安裝完成了。

2. 安裝Apache 及 PHP4

host_name/home/workshop# tar -vzxf apache_1.3.12.tar.gz
host_name/home/workshop# tar -vzxf php-4.0.0.tar.gz

進入apache目錄,預編譯apache

# ./configure --prefix=/home/apache
我們把Apache 安裝在/home目錄下。

進入php目錄,編譯php + sybase
#cd ../php-4.0.0
# ./configure --with-apache=../apache_1.3.12
       --with-mysl=no
       --with-sybase-ct=/opt/sybase-11.9.2/
       --enable-ftp
       --enable-track-vars

# make ; make install
# cp php.ini-dist /usr/local/lib/php.ini
# cd ../apache_1.3.12
# ./configure --prefix=/home/apache --activate-module=src/modules/php4/libphp4.a
# make ; make install

編譯工作已經完成了,現在需要修改一些配置文件。

#cd /home/apache/conf
#vi httpd.conf

修改DirectoryIndex index.html index.php3 index.php那一行
將AddType application/x-httpd-php .php那一行前面的#去掉
加入一行AddType application/x-httpd-php .php3

最後,還需要修改幾個參數
ServerName
ServerAdmin
DocumentRoot "/home/apache/htdocs"
<Directory "/home/apache/htdocs ">
啟動Apache
cd ../bin
./apachectl start

現在,要寫一個文件,讓apache在計算機啟動時也啟動。
and you will edit /etc/rc.d/rc.sysinit , add auto_run file at the last line.
auto_run will be created at /usr/sbin and with +x mode.


auto_run is:
#!/bin/sh
/home/apache/bin/apachectl restart

==================================================================================
安裝部分完成。


Copyright © Linux教程網 All Rights Reserved