laravel-oci8 icon indicating copy to clipboard operation
laravel-oci8 copied to clipboard

Call to undefined function Yajra\Pdo\oci_connect()

Open tima31 opened this issue 6 years ago • 7 comments

hello, I came here after long search 3

in php.ini i removed quotes to both oci8 and oci8_11g capture2

in phpinfo() oci8 seems to be enabled capture

oci8.dll and oci8_11g.dll exist in "C:\wamp\bin\php\php5.5.12\ext"

I use oracle 11g xe instantclient 11.2 downloaded and path added, I tried both 64 bit and 32 bit version

on CLI : run command "php -m" => don't find oci8 run command "php --ri oci8" => extension "oci8" not present

System details

  • Operating System : windows 7 - 64 bits
  • PHP Version : 5.5.12
  • Laravel Version : 5.2.*
  • Laravel-OCI8 Version : 5.2

I tried this code in C:\wamp\www 4 and that worked ! 5

so any help please !

tima31 avatar Feb 19 '19 23:02 tima31

On some installations, php.ini for cli is different. I suggest you check which config file is being loaded on cli and then enable the oci8 plugin there. On mac, here is how I check it.

> php -i | grep php.ini

Configuration File (php.ini) Path => /usr/local/etc/php/7.1
Loaded Configuration File => /usr/local/etc/php/7.1/php.ini

yajra avatar Feb 20 '19 01:02 yajra

Hi, thank you for your reply, on windows >php --ini , and this is what i've got

111

However in phpinfo() : 222

I am confused now is the probleme come from that there are 2 different path for php.ini ?

tima31 avatar Feb 20 '19 08:02 tima31

problem soleved ! it seems that php.ini shown in phpinfo() is used by apache , and it's diffrent from the one used by CLI I enabled oci8 in php.ini which exist in the Loaded Configuration File and now it works.

Thank you

tima31 avatar Feb 20 '19 11:02 tima31

No solving. I have the same Issue. I install Instant Client Downloads for Linux x86-64 v 19.3 and I have the same error:

{ "error": "Internal error", "type": "Call to undefined function Yajra\Pdo\oci_connect()", "code": 500, "error_description": "Ha ocurrido un error, comuníquese con su proveedor", "line": 455, "file": "/home/vagrant/investigarpuj/vendor/yajra/laravel-pdo-via-oci8/src/Pdo/Oci8.php" } With command php -i | grep -i oracle I get this:

vagrant@homestead:~$ php -i | grep -i oracle Oracle Run-time Client Library Version => 19.3.0.0.0 Oracle Compile-time Instant Client Version => 19.3 ORACLE_BASE => /usr/local/lib/instantclient_19_3 ORACLE_HOME => /usr/local/lib/instantclient_19_3 $_SERVER['ORACLE_BASE'] => /usr/local/lib/instantclient_19_3 $_SERVER['ORACLE_HOME'] => /usr/local/lib/instantclient_19_3

I dont know what to do and I'm going crazy!

anfazaba avatar Aug 30 '19 01:08 anfazaba

@anfazaba Take a look at my post on StackOverflow (in particular, the section Edit 5: Solution):

https://stackoverflow.com/questions/50396992/how-does-one-enable-the-oci8-php-extension-using-the-oracle-instant-client-in

Basically, Homestead runs Ubuntu 18.04 LTS, which in turn uses systemd, and additional steps are required to set the environment appropriately when PHP-FPM is started via systemd.

Also, the output you show above is for PHP CLI, which is not the same as PHP-FPM (as noted in several previous comments, above). The output you should be checking is from the phpinfo() function when called from a script within the browser. That is to say, you should create the file public/info.php in your project and access it from within a browser, as that is the only way to know whether PHP-FPM is loading the OCI8 module.

cbj4074 avatar Sep 10 '19 16:09 cbj4074

Really, thank you so much! Description in Edit 5: Solution solved all problem. I didn't know that doing all that process could solve the problem.

Basically doing the following points below:

Needless to say, we want to avoid editing the package maintainer's file (to avoid conflicts during future upgrades), so we extend it instead:

mkdir /etc/systemd/system/php7.1-fpm.service.d

touch /etc/systemd/system/php7.1-fpm.service.d/environment.conf

To this file we add the following:

[Service] Environment=LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2 And to make the change effective:

systemctl daemon-reload

systemctl restart php7.1-fpm

Really thank you so much!!

anfazaba avatar Dec 03 '19 22:12 anfazaba

I cannot resolve this issue with the above solution.

I am using PHP 7.1.33 Oracle Linux Server release 7.7 Laravel 5.7 yajra/laravel-oci8 5.7

Output frpm phpinfo();

image

Under Modules:

image

I am not sure what else to try. It seems like I have everything sorted.

image

Thanks for the help.

iburrows avatar Dec 13 '19 14:12 iburrows

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Nov 03 '22 03:11 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale.

github-actions[bot] avatar Nov 11 '22 03:11 github-actions[bot]