Laravel 相关PHP开发

laravel 操作 oracle数据库

2019-01-22  本文已影响1人  凤之恋

windows下 oracle扩展

;extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client

php5.6.9下为

;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client

Oracle Instant Client下载地址
https://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html

Linux下PHP7 oracle扩展

参照上边的下载地址选择对应安装包

rpm -ivh oracle-instantclient18.3-basic-18.3.0.0.0-1.x86_64.rpm
rpm -ivh oracle-instantclient18.3-devel-18.3.0.0.0-1.x86_64.rpm

https://pecl.php.net/package/oci8
找到对应PHP版本的oci8扩展包

wget https://pecl.php.net/get/oci8-2.2.0.tgz
tar -xzvf oci8-2.2.0.tgz
/usr/local/webserver/php-7/bin/phpize
./configure --with-php-config=/usr/local/webserver/php-7/bin/php-config --with-oci8=instantclient,/usr/lib/oracle/18.3/client64/lib/
make && make install
#vim php.ini找到对应extension 添加 extension=oci8.so 重启php-fpm

Laravel支持oracle数据库操作

使用composer扩展包 yajra/laravel-oci8
https://packagist.org/packages/yajra/laravel-oci8#v5.7.2

参考资料

上一篇 下一篇

猜你喜欢

热点阅读