centos7系统中PHP环境安装oracle数据库扩展控件oci8
技术  /  管理员 发布于 3年前   1349
php中的oci8是支持操作oracle数据库的扩展控件。oci8 函数就是php_oci8.dll 操作ORACLE的一系列函数。要开启这个扩展支持,就在 php.ini 中修改 ;extension=php_oci8.dll 去掉分号 在重名服务就OK了
安装步骤:
1.下载 oracle 文件:
必须和连接的 oracle 数据库一致,如:
连接的是 11.0.2.4 的 oracle,下载的文件就需要是 11 版本的。
以下的用 11.0.2.4 的 oracle 举例操作
下载地址:
https://www.oracle.com/cn/database/technologies/instant-client/linux-x86-64-downloads.html
下载的文件:
1.oracle-instantclient11.1-basic-11.1.0.7.0-1.x86_64.rpm
2.oracle-instantclient11.1-devel-11.1.0.7.0-1.x86_64.rpm
3.oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.x86_64.rpm
2. 安装 oracle-instantclien
2.1 进入到 /usr/local/src/ 目录,把下载好的 rpm 全部拷贝到该目录下
[root@localhost src]# pwd
/usr/local/src
[root@localhost src]# ls
oci8 oracle-instantclient11.1-devel-11.1.0.7.0-1.x86_64.rpm
oracle-instantclient11.1-basic-11.1.0.7.0-1.x86_64.rpm oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.x86_64.rpm
2.2 安装包
rpm -Uvh oracle-instantclient11.1-devel-11.1.0.7.0-1.x86_64.rpm
rpm -Uvh oracle-instantclient11.1-basic-11.1.0.7.0-1.x86_64.rpm
rpm -Uvh oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.x86_64.rpm
2.3 确认安装完成
[root@localhost oracle]# ls
11.1
[root@localhost oracle]# pwd
/usr/lib/oracle
3. 添加 php 的 oci 扩展
3.1. 进入编译包
[root@localhost oci8]# pwd
/var/www/html/php-7.4.0/ext/oci8
3.2./usr/local/php740/bin/phpize
[root@localhost oci8]# /usr/local/php740/bin/phpize
Configuring for:
PHP Api Version: 20190902
Zend Module Api No: 20190902
Zend Extension Api No: 320190902
3.3 ./configure
[root@localhost oci8]# ./configure --with-php-config=/usr/local/php740/bin/php-config --with-oci8=shared,instantclient,/usr/lib/oracle/11.1/client64/lib
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for pkg-config... /bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
3.4 make
[root@localhost oci8]# make && make install
PATH="$PATH:/sbin" ldconfig -n /var/www/html/php-7.4.0/ext/oci8/modules
----------------------------------------------------------------------
Libraries have been installed in:
/var/www/html/php-7.4.0/ext/oci8/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use 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 - use the `-Wl,--rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /usr/local/php740/lib/php/extensions/no-debug-non-zts-20190902/
[root@localhost oci8]# cd /usr/local/php740/lib/php/extensions/no-debug-non-zts-20190902/
[root@localhost no-debug-non-zts-20190902]# ls
gd.so libzip.so mongodb.so oci8.so opcache.a opcache.so redis.so swoole.so xdebug.so zip.so
4.1 引入
vim /usr/local/php740/lib/php.ini
下面每种都可
extension=/usr/local/php740/lib/php/extensions/no-debug-non-zts-20190902/oci8.so
extenstion=oci8.so
完
122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..博主 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..1111 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号