Shafi
Shafi

Reputation: 1970

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.

Upvotes: 1

Views: 4436

Answers (1)

Timekiller
Timekiller

Reputation: 3126

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.

Upvotes: 2

Related Questions