Chinaunix首页 | 论坛 | 博客
  • 博客访问: 127860
  • 博文数量: 34
  • 博客积分: 1201
  • 博客等级: 少尉
  • 技术积分: 365
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-21 08:56
文章分类

全部博文(34)

文章存档

2012年(1)

2011年(15)

2010年(18)

我的朋友

分类: LINUX

2011-08-23 09:46:17

OCI8是访问oracle数据库的一个模组,在安装完oracle client and php package后,

The php patch they provided need to contain OCI so that PHP can connect to remote DB server using oracle client.

 

Please let php patch builder to refer to the following page:
 下载一个oci8的一个比较新版本的包编译,解压后用这个替换php4.3.9/ext/oci8目录
#cd php-4.3.9
#./configure --prefix=/usr/oci --with-oci8=shared,$ORACLE_HOME
#make;make install
将会产生一个oci8.so文件,拷贝oci8.so到/usr/lib64/php/modules/,然后
#vi /etc/php.d/oci8.ini
; Enable oci8 extension module
extension=oci8.so
 
OR
#cd oci8-1.4.1
#phpize
#./configure --prefix=/usr/oci --with-oci8=shared,$ORACLE_HOME
#make;make install

Note:
if you encounter the issue as below when compiling oci8 Or launch httpd with load oci8 module:
Error: Unable to load dynamic library oci8.so, undefine zif_oci_define_by_name
Solution:
    1, rm -f configure file under php-4.3.9 source folder
    2, ./buildconf --force  re-create configure file and re-compile oci8
Note:

1.       Please add following in /etc/sysconfig/httpd:

export ORACLE_HOME=/home/oracle/OraHome1

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib

export PATH=$PATH:$ORACLE_HOME/bin

2.       Make sure the permission of /home/oracle is 755

restart httpd service then test the function of oci8 with PHP

# vi /var/www/html/conora.php
$dbstr ="(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST =10.224.114.23)(PORT = 1501))
(CONNECT_DATA =
(SID = szcndb)
(SERVICE_NAME = szcndb.qa.webex.com)))";
$conn = OCILogon("jabber", "pass", $dbstr );
$query = 'select count(*) from tabs';
$stid = OCIParse($conn, $query);
OCIExecute($stid, OCI_DEFAULT);
 while ($succ = OCIFetchInto($stid, $row)) {
    foreach ($row as $item) {
      echo $item." ";
    }
    echo "
\n";
}
OCILogoff($conn);
?>
阅读(1301) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~