一、基本环境
1、centos7_64+Apache/2.4.43+PHP5.6
2、安装了宝塔面板
二、安装oci8扩展
1、到oracle官网下载:
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
2、安装以上两个rpm包
rpm -ivh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
以上的安装路径为:
/usr/lib/oracle/11.2/client64/lib 和/usr/include/oracle/11.2/client64.
3、到php官网下载oci8-2.0.8.tgz
tar -xvzf oci-2.0.8.tgz
cd oci-2.0.8
/www/server/php/56/bin/phpize
./configure --with-php-config=/www/server/php/56/bin/php-config --with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client64/lib
make && make install
4、在php.ini文件中添加
extension=oci8.so
5、在php-fpm.conf文件中添加环境[env]指向oracle_home路劲
6、重启php-fpm
7、重启apache
service httpd restart