简体   繁体   English

将Laravel与Oracle数据库连接

[英]Connecting Laravel with Oracle Database

I am working on Linux Mint. 我正在使用Linux Mint。 I installed Apache, MySQL, PHP for Laravel and Oracle 11g Express edition. 我安装了Apache,MySQL,用于Laravel的PHP和Oracle 11g Express版。 Then to connect Laravel to Oracle I found this on GitHub . 然后将Laravel连接到Oracle,我在GitHub上找到了它

I did everything according to the documentation there. 我根据那里的文档进行了所有操作。 Then while I run php artisan migrate returns me 然后,当我运行php artisan migrate时,我得到了回报

[Symfony\\Component\\Debug\\Exception\\FatalErrorException]
Call to undefined function Yajra\\Pdo\\oci_connect()

After that I searched on but failed to get anything that work for me. 之后,我进行了搜索,但没有找到对我有用的任何东西。 Got two questions with same problem on Stackoverflow not answered yet. 在Stackoverflow上有两个问题相同的问题尚未回答。 From GitHub issue tab, someone told to active a comment in php.ini file. 在GitHub问题选项卡上,有人告诉激活php.ini文件中的注释。 But there are no such thing in my php.ini file. 但是我的php.ini文件中没有这样的东西。

It sounds like you don't have oci8 extension installed. 听起来您没有安装oci8扩展。 You'll need to get Oracle Instant Client basic and sdk zip packages, unpack them to the same directory, create symbolic links 您需要获取Oracle Instant Client基本和sdk zip软件包,将它们解压缩到同一目录中,创建符号链接。

sudo ln -s libclntsh.so.* libclntsh.so
sudo ln -s libocci.so.* libocci.so

Then do pecl install oci8 , and provide it with the directory path where you have unpacked the instant client to. 然后执行pecl install oci8 ,并提供您将即时客户端解压缩到的目录路径。 It'll compile OCI8 extension on your machine. 它将在您的计算机上编译OCI8扩展。 When it compiles correctly, enable the extension in php.ini: 正确编译后,在php.ini中启用扩展名:

echo "; configuration for php oci8 module" | sudo tee /etc/php5/conf.d/oci8.ini
echo extension=oci8.so | sudo tee -a /etc/php5/conf.d/oci8.ini

and restart apache. 并重新启动apache。 See also this answer , official oracle manual , official php manual or google "linux oci8 pecl howto" for multiple detailed manuals. 另请参见此答案官方oracle手册官方php手册或Google“ linux oci8 pecl howto”,以获取多个详细手册。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM