Yii And Oracle Database

Hello there,

I’m having troubles to run my Yii application. First of all, I’ve to say my application is working well under Windows environnement. The database is under Oracle 11g, connecting both with oci8 and pdo_oci. I mean both ways are working but I’m using only OCI8 on production. I’m now trying to execute it on Ubuntu Server 14.

I’ve tried to run PHP scripts with both pdo_oci and oci8 methods and they’re all working fine (under Ubuntu). I’m using Apache 2.4.7 and PHP 5.5.9.

So the problem comes from Yii. When I try to launch my application, I get this error :


CDbConnection failed to open the DB connection: could not find driver

Here is my config file where I define the database connection :


'db'=>array(

	'class'=>'COciConnection',

	'connectionString' => 'oci:dbname=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myserver.local)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=myservice)));charset=AL32UTF8;',

	'username' => 'login',

	'password' => 'password',

	'schemaCachingDuration'=>3600,

	'enableProfiling' => true, //Developpement

	'enableParamLogging' => true, //Developpement

),

As you can see I’m using “COciConnection” class but I keep getting error on “CDbConnection”. Strange. I’ve changed my class to “CDbConnection” and “ext.oci8Pdo.OciDbConnection” in my config file and I keep getting the same error, regardless the class I’m using. I even tried to connect to a MySQL database and the same is happening (pdo_mysql is also installed on my server).

If I delete the file protected/config/main.php, I get the usual “unable to include main.php” error. Pretty classic. But it seems there is some sort of cache which make every changes to the ‘db’ part useless. I don’t know what to do, I’ve tried everything and I still don’t understand what’s wrong in my config file… Is somebody getting this ? As I said : this exact config file is working under Windows.

Thanks in advance for your help.

No so sure about your specific problem, but the rule of thumb is: if it work on Windows and not on *nix, check the case of your file name, class name and tables…

Well, I tried something else. I deleted that part from my config file :

And I still get the error about drivers not found… I just don’t get it. There is no database defined and Yii still try to connect somewhere… Am I missing something? Because my main.php file is obviously the one Yii use : when I delete it, I get a missing file error.

it says could not find driver, Try a different database server just to test, I do not think its Yii its your ubuntu box

Final word : PDO SQLITE extension was missing on my php installation… While browsing Yii source code, I figured out that it uses SQLite to save sessions.

Thank you all anyway for your help :)