Laravel和oracle连接 [英] Laravel and oracle connection

查看:2027
本文介绍了Laravel和oracle连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图配置laravel与oracle数据库,我试图使用Yajra的连接,但我得到这个错误每次我尝试运行我的应用程序。

I am trying to configure laravel to work with oracle database, I am trying to use Yajra for my connection but I get this error every time I try to run my application.


Oci8.php中的FatalThrowableError第449行:致命错误:调用
未定义函数Yajra \Pdo\oci_connect()

FatalThrowableError in Oci8.php line 449: Fatal error: Call to undefined function Yajra\Pdo\oci_connect()

如果任何人可以帮助我解决这个问题,我将非常感激...

If anyone can help me fix this i will be extremely grateful...

推荐答案



下载<$ c $> 如果您使用的是Windows操作系统,则您的php不支持oci8!

< c> instantclient-basic-windows 从 here
Ccreate文件夹

It because your php do not support oci8!

if you use Windows:

Download instantclient-basic-windows from here Ccreate folder

cd E:/wamp64/bin
mkdir oracle

将下载的instantclient包移动到/ oracle

Move downloaded instantclient package into /oracle

mv instantclient-* E:/wamp64/bin/oracle
unzip instantclient-basic-windows.x64-12.1.0.2.0.zip

instantclient_xx 添加到您的路径和编辑 php.ini

取消注释

extension=php_oci8_12c.dll
extension=php_odbc.dll

重新启动您的wamp,您将看到 oci8

restart your wamp you'll see the oci8

<?
  phpinfo().



如果您使用 Linux



instantclient-basic-linux 和 instantclient-sdk-linux http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html?ssSourceSiteId=ocomenrel =nofollow noreferrer>此处,并将其解压缩到dir中。

if you use Linux:

Download instantclient-basic-linux and instantclient-sdk-linux from here, and unzip it in a dir.

mkdir /opt/oracle
mv instantclient-* /opt/oracle
unzip instantclient-basic-linux-x86-64-11.2.0.2.0
unzip instantclient-sdk-linux-x86-64-11.2.0.2.0

mv instantclient_11_2 instantclient
cd /opt
chown -R root:www-data /opt/oracle
echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient
ldconfig


cd /opt/oracle/instantclient
ln -s libclntsh.so.* libclntsh.so
ln -s libocci.so.* libocci.so

输入'instantclient,/ opt / oracle / instantclient'

you neet to input 'instantclient,/opt/oracle/instantclient'

pecl install oci8

在finish.check之后,如果你在目录中有pci8.so,例如 / usr / lib / php / 20151012

after finish.check if you have pci8.so in directory like /usr/lib/php/20151012

cd /etc/php/7.0/mods-available/
vi oci.ini // extension=oci8.so
cd /etc/php/7.0/fpm/conf.d/
ln -s /etc/php/7.0/mods-available/oci.ini 20-oci.ini

追加路径

vi /etc/environment
# append
export LD_LIBRARY_PATH="/opt/oracle/instantclient"
export TNS_ADMIN="/opt/oracle/instantclient"
export ORACLE_BASE="/opt/oracle/instantclient"
export ORACLE_HOME=$ORACLE_BASE 



Finally

service php7.0-fpm restart

这篇关于Laravel和oracle连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆