PHP 无法开启 OCI8 扩展原因
2022-07-28 15:09:43
141
{{single.collect_count}}

今天刚好有个需求,要用 PHP 把数据写入远程?Oracle 数据库,所以要用到?OCI8 扩展。但总是无法开启,查阅了大量资料才知道原来是因为本地机器没安装?Oracle 数据库,?系统缺少Oracle的几个关键DLL造成的,可以通过安装Oracle Instant Client 来添加这些DLL。

?

Oracle Instant Client下载地址如下:

http://www.oracle.com/technetwork/cn/database/features/instant-client/index-092537-zhs.html

?

下载后,将其解压到 D:\Program Files\instantclient_11_2 (非固定位置),并将该路径加入到系统PATH环境变量的最前面。

然后重启一下Webserver,再查看phpinfo,可以OCI8模块信息了。

?

总结一下,PHP OCI8扩展的开启步骤:

(1)去掉php.ini中extension=php_oci8.dll前面的注释



?

(2)解压 Oracle Instant Client,并将解压目录加入到系统PATH环境变量中。

?



?

(3)重启Webserver,使用phpinfo查看OCI8模块是否出现。

?



?

下面是Oracle官方的安装说明,很详细:

《nstalling PHP and the Oracle Instant Client for Linux and Windows

http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html

?

另外关于PHP操作Oracle的资料,这个感觉不错:

http://www.oracle.com/technetwork/cn/articles/dsl/technote-php-instant-090922-zhs.html

?

OCI8操作Oracle的PHP手册:

http://php.net/manual/en/book.oci8.php

原文链接:http://woqilin.blogspot.com/2016/04/php-oci8.html

个人主页:https://plus.google.com/+sherlockwang/posts

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}