laravel-oci8: PHP says: Call to undefined function yajra\\Pdo\\oci_connect() but I have OCI8 installed and enabled

Ok, guys, I don’t know for sure if this is a bug, but I report it because this is very strange. First of wall, I got this error when I try to seed my database using the comand (only when I try to seed):

 php artisan db:seed

Then I got the error:

{“error”:{“type”:“Symfony\Component\Debug\Exception\FatalErrorException”,“message”:“Call to undefined function yajra\Pdo\oci_connect()”,“file”:“/var/www/html/po/vendor/yajra/laravel-pdo-via-oci8/src/yajra/Pdo/Oci8.php”,“line”:81}}

Ok, now first question: Do I have to install PDO OCI?

I just installed OCI8 with Instant Client 12:

sudo pecl install oci8

Added: extension=oci8.so in oci8.ini at /etc/php5/fpm/conf.d. Checked the install with <?php phpinfo(); ?>and it’s OK (see attached image). oci8

Well, after all those configuration, I started install yajra/laravel-oci8. Added the configuration at composer.json. Added, yajra\Oci8\Oci8ServiceProvider' in config/app.php and I configured the database. Ok then, now I can connect successfully but I got the error when I try to seed the database.

My environment:

  • Apache 2.4;
  • PHP 5.6;
  • Laravel 4.2;
  • PHP OCI8 2.0.8.
  • yajra/laravel: 2.1.0;
  • Oracle Instant Client 12.1;
  • Linux Mint 17.1

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Hi! Just experienced this issue today while setting up homestead with php5-fpm. The solution for this was to add extension=oci8.so on /etc/php5/cli/php.ini. Finally found it after an hour of researching and no luck finding anything that works. This was just a wild guess using trial and error but it works. It appears that cli have different php.ini than the fpm/web config.