首页 > 作文

PHP下的Oracle客户端扩展(OCI8)安装教程

更新时间:2023-04-06 09:30:27 阅读: 评论:0

最近的项目需要用php访问oracle数据库,不得不在linux下给php安装oci8扩展。php也可以使用pdo访问oracle数据库,但还是需要安装客户端。

首先到oracle官网的这个页面下载相关的文件,注意要连数据库服务器的版本,一定要对应,否则安装成功也会连不上,同时也要区分32位、64位服务器,比如我要连的数据库服务器是oracle10.绿2.0.4,64位主机,那么我要下载下面三个文件:

复制代码 代码如下:

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

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扩展

复制代码 代码如下:

# yum install libaio

# cd ~

# wget http://pecl.php.net/get/oci8-1.3.5.tgz

3.然后执行命令

复制代码 代码如下:

# t电工实训ar zxvf oci8-1.3.5.tgz

# cd oci8-1.3.5/

# /usr/local/php5/bin/phpize cflags=/usr/lib/oracle/11.2/client64/ cxxflags=/usr/lib/oracle/11.2/client64/

# ./configure –with-php-config=/usr/local/php5/bin/php-config –with-oci8=instantclient,/usr/lib/oracle/11.2/client64/lib/

# make

# make install(这里多运行几次壮阳果,直到出现如下提示)



[root@webrver02 oci8-1.3.5]# make install

/bin/sh /roo形容女性t/oci8-1.3.5/libtool –mode=install cp ./oci8.la /root/oci8-1.3.5/modules

cp ./.libs/oci8.so /root/oci8-1.3.5/modules/oci8.so

cp ./.libs/oci8.lai /root/oci8-1.3.5/modules/oci8.la

path=”$path:/sbin” ldconfig -n /root/oci8-1.3.5/modules

———————————————————————-

libraries have been installed in:

/root/oci8-1.3.5/modules

if you ever happen to want to link against installed libraries
in a given directory, libdir, you must either u libtool, and
specify the full pathname of the library, or u the `-llibdir’
flag during linking and do at least one of the following:
– add libdir to the `ld_library_path’ environment variable
during execution
– add libdir to the `ld_run_path’ environment variable
during linking
– u the `-wl,–rpath -wl,libdir’ linker flag
– have your system administrator add libdir to `/etc/ld.so.conf’

e any operating sys小区业主委员会tem documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
———————————————————————-
installing shared extensions: /usr/local/php5/lib/php/extensions/no-debug-zts-20090626/
# cd /usr/local/php5/lib

4.创建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

如下:

复制代码 代码如下:

extension_dir = “/usr/local/php5/lib/ext”

extension = “oci8.so”

ssion.save_path = “/tmp/php”

oci8.privileged_connect = on

重启apache服务:

复制代码 代码如下:

/usr/local/apache2/bin/apachectl stop

/usr/local/apache2/bin/apachectl start

刷新测试页面。发现oci8出现了,则大功告成.

本文发布于:2023-04-06 09:30:24,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/zuowen/69fa612353f7dd6f35b1c8c54a5552f0.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

本文word下载地址:PHP下的Oracle客户端扩展(OCI8)安装教程.doc

本文 PDF 下载地址:PHP下的Oracle客户端扩展(OCI8)安装教程.pdf

标签:代码   我要   数据库   服务器
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图