yajra / laravel-oci8

Oracle DB driver for Laravel via OCI8
https://yajrabox.com/docs/laravel-oci8
MIT License
832 stars 237 forks source link

Unsupported driver [pdo-via-oci8] #2

Closed warroyo closed 10 years ago

warroyo commented 10 years ago

I am seeing an issue where laravel is not recognizing the pdo-via-oci8 driver. I have oci8 enabled in my php install and have followed the install directions for this package. is there a step that I am missing?

yajra commented 10 years ago

Can you please provide the error details or screenshot and the environment you are using?

On the other hand, I think some WAMP installation is not working well with oci8. I suggest using Zend CE/Free Edition as one of my friend uses WAMP and having some issue too. When he changed to Zend, all works well. Just in case you are using wamp.

salluri27 commented 10 years ago

I am unable to connect to oracle database using pdo-via-oci8 driver. I am developing on linux server.

warroyo commented 10 years ago

Ok I have solved the issue. I am able to connect successfully all the time except for when I try to dynamically set the db config. is i use the "config::set" function and attempt to specify the "pdo-via-oci8" driver that way it fails. you must specify the driver in the config database.php

salluri27 commented 10 years ago

I did set the driver information in the database.php config file.

warroyo commented 10 years ago

can you please post your config settings

salluri27 commented 10 years ago
    'oracle' => array(
        'driver' => 'pdo-via-oci8',
        'host' => '',
        'port' => '1521',
        'database' => '', // Service ID
        'username' => '',
        'password' => '',
        'charset' => 'utf8',
        'prefix' => '',
    ),
warroyo commented 10 years ago

I am assuming you have the 'host', 'username', and 'password' filled in and you just removed them for posting? becuase if you do not have those, then it will not connect.

salluri27 commented 10 years ago

I tried to display the connection the connection error. Here is what I see

oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries

salluri27 commented 10 years ago

I removed them for security purpose

warroyo commented 10 years ago

that looks like you do not have the oci8 module installed in php. you will need this and the instant client in order for the package to work.

salluri27 commented 10 years ago

All other applications on my linux server are working. They connect to the oracle database successfully . I only have problem with it when I connect to it using Laravel Framework. I am new to Laravel.

warroyo commented 10 years ago

do you have the instant client location in your LD_LIBRARY_PATH as it says?

salluri27 commented 10 years ago

I am using latest version of PHP 5.5.5 . My oci8 version 1.4.10 . I don't know if they are compatible. Previously I have some problem when I worked on WAMP server

yajra commented 10 years ago

you need to have Basic and the SDK Instant Client installed on your machine for oci8 to work properly. In some cases, if you are using Oracle 11g, you might as well use the oci811g extension instead of oci8 (have done this on my windows virtual machine). See link below for some reference.

http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html

salluri27 commented 10 years ago

I am not actually working on windows. I am working on Linux box. It has the latest versions of php, oci8 driver and oracle instant client

crazycodr commented 10 years ago

A quick drop in on that long issue....

PDO via OCI8 is just a layer i created to map oci8 functions to a PDO driver. It is not a driver in itself, just a layer over existing functions. Same thing goes for Laravel via Oci8.

The first thing you should check and fix is : Can you connect to the oracle server using standalone methods such as the following code below? (Just change the settings to yours)

$conn = oci_connect('hr', 'welcome', 'localhost/XE');
if (!$conn) {
    $e = oci_error();
    var_dump($e);
}

If you can't connect using this, then PDO via Oci8 won't work... It's not a driver in itself, just a layer to simplify things.

I then suggest revising your whole configuration from the ground up...

If you say that other applications are connecting successfully, compare their settings:

Ensure the native oci8 functions work and then pdo via oci8 will work.

warroyo commented 10 years ago

can you please "echo $LD_LIBRARY_PATH" on your lunix machine. according to the error, it could be as simple as including the libraries in your path. can you please respond with the result of the echo.

salluri27 commented 10 years ago

Sorry for the confusion I have created. None of the applications are working on this box. Should I have oracle instant client installed on Linux box for oci8 to work?

salluri27 commented 10 years ago

I echoed it. It is not displaying anything . This path is not set on my linux box. It is the new server I am working on.

warroyo commented 10 years ago

that will definitely be a problem, have you tried what @crazycodr suggested? Do you have the oci8 php extension installed? also do you have the instant client installed?

if you have both oci8 and the instant client, you will need to get the path to the instant client libraries and add it to your LD_LIBRARY_PATH.

to add it to your path simply:

export LD_LIBRARY_PATH=/full/path/to/oracle/instant/client

salluri27 commented 10 years ago

The problem is with my environment set up. I didn't have the oracle instant client installed on my linux server. After installing it, it started working. Thank u all for helping me fix this issue. And pdo-via-oci8 driver is working perfect. Thanks once again.