呵呵,純粹玩笑,僅供自己備忘。“老婆”是指LAOP,也就是Linux+Apache+Oracle+PHP,我們公司的開發應用環境。 因為接觸後覺得比別的Linux配置和使用起來更簡潔方便,所以Linux我選了Ubuntu 6.10 Server,用於公司已經有現成的Oracle資料庫伺服器了,所以只安裝了Oracle XE client。下面是實戰過程記錄: 一、基本安裝 進行Ubuntu 6.10 server和Apache、PHP等的安裝,懶點的可以在安裝Ubuntu時候選擇裝好LAMP。具體安裝過程可以參考http://www.ubuntu.org.cn上的文檔,這裡我也不再嘮叨了。 二、安裝Oracle XE client 以能夠使用sudo的普通使用者登陸並編輯apt源列表檔案
| sudo vi /etc/apt/sources.list |
在sources.list檔案中加入下面行
| deb http://oss.oracle.com/debian unstable main non-free |
存檔退出並執行下面命令:
| sudo groupadd oracle; sudo groupadd dba sudo useradd -d /home/oracle -g oracle -G dba -m -s /bin/bash oracle sudo apt-get update sudo apt-get install bc libaio sudo apt-get install oracle-xe-client |
安裝好oracle-xe-client後,oracle使用者還需配置一下各種環境參數,可以利用
| /usr/lib/oracle/xe/app/oracle/product/10.2.0/client/bin/oracle_env.sh |
進行設定或者直接把環境參數添加到自己的.bash_profile檔案中去。
在安裝完client後,應運行sqlplus串連Oracle資料庫來驗證一下client安裝的正確與否。
三、安裝PHP oci8 extension
還是以能夠使用sudo的普通使用者身份運行下面命令:
| sudo apt-get install build-essential sudo apt-get install php5-dev php-pear sudo pecl install oci8 |
在下列提示後輸入$ORACLE_HOME的實際路徑(我自己的是/usr/lib/oracle/xe/app/oracle/product/10.2.0/client):
| sail@ubuntu:~$ sudo pecl install oci8 downloading oci8-1.2.2.tgz ... Starting to download oci8-1.2.2.tgz (71,806 bytes) .................done: 71,806 bytes 10 source files, building running: phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20050922 Zend Extension Api No: 220051025 Please provide the path to ORACLE_HOME dir. Use instantclient,/path/to/instant/client/lib if youre compiling against Oracle Instant Client [autodetect] : |
在系統編譯安裝好以後,應該在/usr/lib/php5/20051025(我的php是5.1.6版本的)目錄下有一個oci8.so檔案。之後執行命令:
| sudo vi /etc/php5/apache2/php.ini |
在相應位置加上
存檔退出後重啟apache2
| sudo /etc/init.d/apache2 restart |
現在,我們的“老婆”就大功告成了!用瀏覽器來驗證一下吧!