2007-08-21

php-oci8 on centos5

環境: RHEL5 i386 (底下是用 CentOS 5, yum update 跑過先)
FreeBSD? cd /usr/ports/databases/php5-oci8 ; make install clean; 搞定收工

取得 http://ftp.freshrpms.net/pub/freshrpms/redhat/testing/EL5/oracle/SRPMS/oracle-instantclient-10.2.0.3-1.nosrc.rpm
# rpm -hiv ...

取得 http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html 底下的
instantclient-basic-linux32-10.2.0.3-20061115.zip
instantclient-jdbc-linux32-10.2.0.3-20061115.zip
instantclient-odbc-linux32-10.2.0.3-20061115.zip
instantclient-sdk-linux32-10.2.0.3-20061115.zip
instantclient-sqlplus-linux32-10.2.0.3-20061115.zip
將上述檔案放到 /usr/src/redhat/SOURCES
然後開始編了

# cd /usr/src/redhat
# rpmbuild -ba SPECS/oracle-instantclient.spec
接下來把編出來的東西都裝一裝。unixODBC 一般人不會裝到, 所以列在下面免得漏掉
# yum install unixODBC.i386
# cd /usr/src/redhat/RPMS
# for i in *.rpm; do rpm -hiv ${i}; done

取得 http://ftp.freshrpms.net/pub/freshrpms/redhat/testing/EL5/oracle/i386/php-oci8-5.1.6-1.el5.i386.rpm
# rpm -hiv ...
# ldconfig (refresh cache. 好像不用? 管它, 有拜有保佑)
接下來就是重啟 apache
# service httpd stop
# service httpd start
開 phpinfo 去看, 應當可以看到 oci8 在裡面了。
裝起來後, 其它調校的文件, 就自行 google 吧 ...

懶人包? 等我有空吧 zzz

2 comments:

evi1[c] said...

google "lazy_php_oci8_el5.sh" for lazy pack :p

Unknown said...

你好,
我也想在RHEL5上使用PHP連線Oracle。
我是PHP5.1.6(可能是RHEL5預裝的PHP,沒辦法Rebuild,我曾經下載過php-5.1.6-20.el5.src.rpm,修改php.spec後,編譯失敗)
小弟有幸從這裡想到解決方法,按照您的作法。到最後一步。
rpm -hiv php-oci8-5.1.6-1.el5.i386.rpm時,
出現下面的錯誤。
warning: php-oci8-5.1.6-1.el5.i386.rpm: Header V3 DSA signature: NOKEY. key ID e42d547b
error: Failed dependencies:
libclntsh.so.10.1 is needed by php-oci8-5.1.6-1.el5.i386
oracle-instantclient = 10.2.0.3 is needed by php-oci8-5.1.6-1.el5.i386

請問一下是什麼原因呢?不知道能不能給些建議,謝謝!