1、下载Oracle即时客户端程序包 — Basic: 运行 OCI、OCCI 和 JDBC-OCI 应用程序所需的所有文件
①、打开以下网址(本文以32位版为例):
(Linux 32位版)http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html
(Linux 64位版)http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxx86_64soft.html
下载URL http://www.oracle.com/technetwork/indexes/downloads/index.html
②、下载以下几个文件:
2、安装Oracle即时客户端程序包
3、安装OCI8 PHP扩展(使用PHP自带的OCI8,假设PHP程序安装在/usr/local/php/)
4、修改PHP配置文件(/usr/local/php/etc/php.ini)
在extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"后增加一行:
5、重启PHP
6、创建一个phpinfo.php文件(内容如下)并通过Web访问,如果有“oci8”这一项,则表明安装成功。
(1).
/usr/local/soft/oci8-1.3.5/oci8.c:3082: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'php_oci_ping_init'
make: *** [oci8.lo]
./configure --with-php-config=/usr/local/php/bin/php-config --with-oci8=shared,instantclient,/usr/lib/oracle/11.1/client/lib/
http://cn.php.net/manual/en/oci8.installation.php
(2).
[root@localhost etc]# ulimit -SHn 65535
[root@localhost etc]# /usr/local/php/sbin/php-fpm restart
Shutting down php_fpm . done
Starting php_fpm PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/oci8.so' - /usr/lib/oracle/11.1/client/lib/libnnz11.so: cannot restore segment prot after reloc: Permission denied in Unknown on line 0
done
原来不是安装的问题,是linux下面自带的SELinux全称是Security Enhanced Linux在作怪,于是关掉它就ok了
[root@localhost etc]#
[root@localhost etc]# /usr/sbin/setenforce 0
使用php -m命令可以查看php是否已经装载了oci8模块
[root@localhost etc]#php -m | grep oci
oci8
http://blog.s135.com/post/411/1/1/