php.ini setting in yiic console

Hi I have been working on creating a model for a couple of days and I keep running into the problem that the php.ini file used on my shared hosting server doesn’t have PDO enabled by default.

Working with my hosting company they let me know I can use the -c flag to specify the php.ini file I wish to load when I run my script (see command they supplied):

php -c /home/username/public_html/php.ini /home/username/public_html/myscript.php

So I’ve tried php -c /home/username/public_html/php.ini /home/username/public_html/yii/jobsearch/protected/yiic shell ../index.php

and various permutations of that path… no luck.

Any suggestions?

What kind of error message do you receive? Even if you specifiy pdo in your ini file you need the drivers to be installed.

You have to create the php.ini file first and then supply it’s path with -c.

Far below is the recurring error message. PDO is available in my shared hosting environment, and I have created a php.ini file with this codeblock as supplied by my host:

extension=pdo.so

extension=pdo_sqlite.so

extension=sqlite.so

extension=pdo_mysql.so

I am using mysql, and the line in my controller where I call in the database is

	'db'=>array(


		'connectionString'=>'mysql:host=localhost;dbname=mydbname',


		'username'=>'myuser',


		'password'=>'mypass!',


	),

–Error Message–

>> model Content generate Content.php

<br />

<b>Warning</b>: include(PDO.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory in <b>/home1/resolut1/public_html/yii/framework/YiiBase.php</b> on line <b>324</b><br />

<br />

<b>Warning</b>: include() [<a href=‘function.include’>function.include</a>]: Failed opening ‘PDO.php’ for inclusion (include_path=’.:/home1/resolut1/public_html/yii/jobsearch/protected/components:/home1/resolut1/public_html/yii/jobsearch/protected/models:/usr/lib/php’) in <b>/home1/resolut1/public_html/yii/framework/YiiBase.php</b> on line <b>324</b><br />

<br />

<b>Fatal error</b>: Class ‘PDO’ not found in <b>/home1/resolut1/public_html/yii/framework/db/CDbConnection.php</b> on line <b>282</b><br />

Thanks for your response!