简体   繁体   中英

Connecting Laravel with Oracle Database

I am working on Linux Mint. I installed Apache, MySQL, PHP for Laravel and Oracle 11g Express edition. Then to connect Laravel to Oracle I found this on GitHub .

I did everything according to the documentation there. Then while I run php artisan migrate returns me

[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. From GitHub issue tab, someone told to active a comment in php.ini file. But there are no such thing in my php.ini file.

It sounds like you don't have oci8 extension installed. You'll need to get Oracle Instant Client basic and sdk zip packages, unpack them to the same directory, create symbolic links

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. It'll compile OCI8 extension on your machine. When it compiles correctly, enable the extension in 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. See also this answer , official oracle manual , official php manual or google "linux oci8 pecl howto" for multiple detailed manuals.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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