-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP says: Call to undefined function yajra\\Pdo\\oci_connect() but I have OCI8 installed and enabled #54
Comments
You don't need to install PDO_OCI. Question: Does Laravel works when you access it on the browser? Try testing the connection on a test route. If it works then the problem must be on your PHP CLI configuration. Route::get('test', function() {
dd (DB::connection()->getPdo());
}); |
Also check your PHP CLI environment. Most probably, you have multiple php installations? Try running |
Hi! Thanks for the answers! I have installed PHP with
About your second question, yes, it works when I access on the browser. I just changed your code to specify my Oracle connection (not my default connection): Route::get('test', function() {
dd(DB::connection('e1')->getPdo());
}); When I accessed on the browser, no error has been shown. Output: object(yajra\Pdo\Oci8)[218]
public '_dbh' => resource(4, oci8 connection)
protected '_options' =>
array (size=4)
8 => int 2
3 => int 2
11 => int 0
'charset' => string 'AL32UTF8' (length=8)
protected '_inTransaction' => boolean false
protected '_table' => null To provide more details about this problem, here is the seed that when I run, raises the problem shown. In my seed, I connect in a Oracle database, query against it, get the data and insert into my default database (pgsql). public function run() {
DB::transaction(function() {
DB::table('activities')->delete();
$e1Activities = DB::connection('e1')->select('SELECT * FROM vw_activities');
foreach($e1Activities as $e1Atv) {
$poAtv = array('code' => trim($e1Atv->code),
'desc' => trim($e1Atv->desc),
'type' => $e1Atv->type,
'codeu' => $e1Atv->codeu,
'codedir' => $e1Atv->codedir,
'sigdir' => $e1Atv->sigdir,
'codeemp' => $e1Atv->codeemp,
'codetec' => $e1Atv->codetec,
'active' => $e1Atv->active,
'conv' => trim($e1Atv->conv),
'user' => trim($e1Atv->user),
'codemas' => $e1Atv->codemas,
'date' => $e1Atv->date);
DB::table('activities')->insert($poAtv);
}
});
} |
Hi! More details. Maybe can help. I tried to run the same command in another enviroment (my work - Linux Mint also and Windows 7 64 bits with Xampp). Same problem. On Windows machine, I collected the stacktrace (below). Now I don't know if this is a bug or if there is a problema with my project. :( The error occurs exactly on this line in the seeder:
|
Hi, The output on your browser indicates that TroubleshootingThe most common problem with installing OCI8 is not having the Oracle environment correctly set. This typically appears as a problem using oci_connect() or oci_pconnect(). The error may be a PHP error such as |
Well, after days working and researching about this issue, I think I got, at least, one conclusion: *Oracle is a Hell on Earth! I have tested on two Linux Machines and one Windows Machine. All of them had the same problem. However, on my last try on Linux, I purged every PHP package, Apache and Oracle Client from my system. Completely clean. Then, I downloaded Xampp for Linux and I enabled oci8 under xampp using default client that ships with xampp (version 11.2.0.3.0). Tested with Don't know why, but it worked. I think it's because Oracle Instant Client version, but I tried with versions 12, and 10 (both 32 and 64 bits). They didn't worked. Well, now I will keep working with xampp. |
Yeah, I agree that setting up oci8 is a bit frustrating. Been there on my first or so months working on php oracle and sort it out using Zend Server which works well out of the box just by enabling oci8 extension. ^_^ Anyways, good to know that you sort it out on Xampp. 🍻 |
Hi! Just experienced this issue today while setting up homestead with php5-fpm. The solution for this was to add |
Thank you! Today I setup a new enviroment for a new project and I experienced this issue again. I created a new file named |
Well, the error always occurs when I use command line tools, like migrate or seed. So, when I use |
Yes, I can confirm that |
Hi everybody. I recently installed this library using WAMP. I spent almost two days trying to configurate it, but the error wasn't in the library. The thing is that WAMP has TWO php.ini files. The one you choose from the icon in your System Tray is the file in php folder, but also you have to uncomment the "extension=php_oci8_11g.dll" in the php.ini found in the apache/bin folder so you can use artisan in your CLI. |
I have a same issue. I use following requirement:
Is the version 1.* compatible with php 5.6? |
@yajra : yajra can i migrate in oracle ? |
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):
Then I got the error:
Ok, now first question: Do I have to install PDO OCI?
I just installed OCI8 with Instant Client 12:
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).Well, after all those configuration, I started install
yajra/laravel-oci8
. Added the configuration atcomposer.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:
The text was updated successfully, but these errors were encountered: