前置条件
php7,编译的目录参数如下
./configure --prefix=/opt/php7 --with-config-file-scan-dir=/opt/php7/etc/php.d
-
Linux上有Oracle服务(方便原则,可用docker来创建Oracle测试)
yum install docker 先安装docker
systemctl start docker 启动docker
docker pull alexeiled/docker-oracle-xe-11g 拉取oracle 11g镜像
docker run -d --shm-size=1g -p 8080:8080 -p 1521:1521 -v /local-initdb:/etc/entrypoint-initdb.d alexeiled/docker-oracle-xe-11g 启动镜像
-
Oracle连接信息
hostname: localhost
port: 1521
sid: xe
username: system
password: oracle
创建用户
create user phper identified by 123456789
grant create session to phper;
grant connect, resource to phper
-
提供PHP服务的主机上得装有Oracle的客户端(
Oracle官网可获取
)地址
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
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
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
安装拓展
装oci8
cd /tmp/php-7.1.1/ext/oci8/
/opt/php7/bin/phpize
./configure --prefix=/opt/php7 --with-php-config=/opt/php7/bin/php-config --with-oci8=instantclient,/usr/lib/oracle/11.2/client64/lib
make && make install
装pdo-oci
cd /tmp/php-7.1.1/ext/pdo_oci/
/opt/php7/bin/phpize
./configure --prefix=/opt/php7 --with-php-config=/opt/php7/bin/php-config --with-pdo-oci=instantclient,/usr,11.2
make && make install
添加到配置中
mkdir /opt/php7/etc/php.d
cd /opt/php7/etc/php.d
echo extension=oci8.so > oci8.ini
echo extension=pdo_oci.so > pdo_oci.ini
添加环境变量
vi /opt/php7/etc/php-fpm.d/www.conf
env[LD_LIBRARY_PATH] = /usr/lib/oracle/11.2/client64/lib
env[ORACLE_HOME] = /usr/lib/oracle/11.2/client64/lib
重启
显示
phpinfo();
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。