laravel-oci8
laravel-oci8 copied to clipboard
Call to undefined function Yajra\Pdo\oci_connect()
hello, I came here after long search
in php.ini i removed quotes to both oci8 and oci8_11g
in phpinfo() oci8 seems to be enabled
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
and that worked !
so any help please !
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
Hi, thank you for your reply, on windows >php --ini , and this is what i've got
However in phpinfo() :
I am confused now is the probleme come from that there are 2 different path for php.ini ?
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
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 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.
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!!
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();
Under Modules:
I am not sure what else to try. It seems like I have everything sorted.
Thanks for the help.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 7 days since being marked as stale.