国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 數(shù)據(jù)庫(kù) > Oracle > 正文

PHP下的Oracle客戶端擴(kuò)展(OCI8)安裝教程

2024-08-29 13:28:32
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

這篇文章主要介紹了PHP下的Oracle客戶端擴(kuò)展(OCI8)安裝教程,本文在Linux系統(tǒng)中實(shí)現(xiàn),OCI8是用來(lái)連接Oracle數(shù)據(jù)庫(kù)的PHP擴(kuò)展模塊,需要的朋友可以參考下

最近的項(xiàng)目需要用php訪問(wèn)oracle數(shù)據(jù)庫(kù),不得不在linux下給php安裝oci8擴(kuò)展。php也可以使用pdo訪問(wèn)oracle數(shù)據(jù)庫(kù),但還是需要安裝客戶端。

首先到oracle官網(wǎng)的這個(gè)頁(yè)面下載相關(guān)的文件,注意要連數(shù)據(jù)庫(kù)服務(wù)器的版本,一定要對(duì)應(yīng),否則安裝成功也會(huì)連不上,同時(shí)也要區(qū)分32位、64位服務(wù)器,比如我要連的數(shù)據(jù)庫(kù)服務(wù)器是oracle10.2.0.4,64位主機(jī),那么我要下載下面三個(gè)文件:

  1. oracle-instantclient-basic-10.2.0.4-1.x86_64.rpm 
  2. oracle-instantclient-devel-10.2.0.4-1.x86_64.rpm 
  3. oracle-instantclient-sqlplus-10.2.0.4-1.x86_64.rpm 

1.用以下命令安裝,代碼如下:

  1. # rpm -ivh oracle-instantclient-basic-10.2.0.4-1.x86_64.rpm oracle-instantclient-devel-10.2.0.4-1.x86_64.rpm    oracle-instantclient-sqlplus-10.2.0.4-1.x86_64.rpm 

2.安裝OCI8 PHP擴(kuò)展,代碼如下:

  1. # yum install libaio 
  2. # cd ~ 
  3. # wget http://pecl.php.net/get/oci8-1.3.5.tgz 

3.然后執(zhí)行命令,代碼如下:

  1. # tar zxvf oci8-1.3.5.tgz 
  2. # cd oci8-1.3.5/ 
  3. # /usr/local/php5/bin/phpize  CFLAGS=/usr/lib/oracle/11.2/client64/ CXXFLAGS=/usr/lib/oracle/11.2/client64/ 
  4. # ./configure --with-php-config=/usr/local/php5/bin/php-config --with-oci8=instantclient,/usr/lib/oracle/11.2/client64/lib/ 
  5. # make 
  6. # make install(這里多運(yùn)行幾次,直到出現(xiàn)如下提示) 
  7.  
  8. [root@webserver02 oci8-1.3.5]# make install 
  9. /bin/sh /root/oci8-1.3.5/libtool --mode=install cp ./oci8.la /root/oci8-1.3.5/modules 
  10. cp ./.libs/oci8.so /root/oci8-1.3.5/modules/oci8.so 
  11. cp ./.libs/oci8.lai /root/oci8-1.3.5/modules/oci8.la 
  12. PATH="$PATH:/sbin" ldconfig -n /root/oci8-1.3.5/modules 
  13. ---------------------------------------------------------------------- 
  14. Libraries have been installed in: 
  15.    /root/oci8-1.3.5/modules 
  16. If you ever happen to want to link against installed libraries 
  17. in a given directory, LIBDIR, you must either use libtool, and 
  18. specify the full pathname of the library, or use the `-LLIBDIR' 
  19. flag during linking and do at least one of the following: 
  20.    - add LIBDIR to the `LD_LIBRARY_PATH' environment variable 
  21.      during execution 
  22.    - add LIBDIR to the `LD_RUN_PATH' environment variable 
  23.      during linking 
  24.    - use the `-Wl,--rpath -Wl,LIBDIR' linker flag 
  25.    - have your system administrator add LIBDIR to `/etc/ld.so.conf' 
  26.  
  27. See any operating system documentation about shared libraries for 
  28. more information, such as the ld(1) and ld.so(8) manual pages. 
  29. ---------------------------------------------------------------------- 
  30. Installing shared extensions:     /usr/local/php5/lib/php/extensions/no-debug-zts-20090626/ 
  31. # cd /usr/local/php5/lib 

4.創(chuàng)建ext目錄,代碼如下:

# mkdir ext/

把oci8.so文件拷貝到php.ini 的ext目錄里面,代碼如下:

# cp /root/oci8-1.3.5/modules/oci8.so /usr/local/php5/lib/ext/

5.在php.ini里面加上extension=oci8.so

如下:

  1. extension_dir = "/usr/local/php5/lib/ext" 
  2. extension = "oci8.so" 
  3. session.save_path = "/tmp/php" 
  4. oci8.privileged_connect = on 

重啟apache服務(wù):

/usr/local/apache2/bin/apachectl stop

/usr/local/apache2/bin/apachectl start

刷新測(cè)試頁(yè)面。發(fā)現(xiàn)oci8出現(xiàn)了,則大功告成.

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 桂林市| 额敏县| 武定县| 都兰县| 木兰县| 新郑市| 台江县| 丹寨县| 获嘉县| 任丘市| 兖州市| 临安市| 峨山| 东兰县| 星子县| 博客| 苍梧县| 富阳市| 福建省| 双江| 锡林浩特市| 静安区| 桑植县| 剑河县| 丰原市| 庄河市| 泗洪县| 宣城市| 当阳市| 淳化县| 布尔津县| 肇源县| 柳河县| 昆山市| 天峻县| 措美县| 永仁县| 临江市| 鄢陵县| 彭阳县| 罗源县|