0

I am trying to use the yii framework for a while. I have been referring - first-app-doc and yiic-doc.

I have read all the posts related to mine on "stackoverflow" but couldn't get any luck resolving my problem. Mostly because I am stuck on the .ini files and the pdo.

I have modified the config file-protected/config/main.php according to my database configuration. I am using the command line tool - yiic to create the model. It gives me 'http://hostname/path/to/index.php?r=user' to hit.

When I hit http://localhost/index.php?r=user; it gives CDbException - CDbConnection failed to open the DB connection: could not find driver in the browser itself. It seems like it can't find the pdo_mysql.
Also, I don't have the php.ini file in /etc/php5/, but I have different php.ini files in /etc/php5/cgi/, /etc/php5/apache2/ and /etc/php5/cli/.

Also, the php5-mysql package, I have it installed on my computer.

I have been trying and trying. This is like impossible to do.

hakre
  • 193,403
  • 52
  • 435
  • 836
Hussain
  • 5,057
  • 6
  • 45
  • 71
  • 3
    Run `phpinfo()`, see what drivers are installed and cross-reference this with your Yii configuration. Then enable the missing extension from `php.ini` (`phpinfo` will also tell you which php.ini is in use). – Jon Oct 01 '12 at 12:35
  • Yes @Jon. it is `/etc/php5/cgi/php.ini`, but I don't know how and why. Also I did some surfing and [link](http://www.howtoforge.com/installing-nginx-with-php5-and-mysql-support-on-ubuntu-8.10) says that I should modify `cgi.fix_pathinfo` from `/etc/php5/cgi/php.ini/` to 1. I think when I follow the above link, it works. I am really confused why this works. – Hussain Oct 01 '12 at 13:30
  • check this: http://stackoverflow.com/questions/2215727/mysql-functions-dont-load-when-using-custom-php-ini-on-windows-server It says each and everything, here is nothing to do with yii – Elbek Oct 02 '12 at 00:31

2 Answers2

1

I know this is a little old question now but hopefully it can help other people, I actually had the same issue I was using it on Google Compute engine where we set up the server and we found out you have to install sqlite PDO extension as well as the MySQL PDO extension.

More information is on my question: https://stackoverflow.com/a/24555366/817213

Hopefully this can help other people too.

Community
  • 1
  • 1
Rich
  • 523
  • 2
  • 6
  • 19
-1

1- try to access the database with MAMP or WAMP or XAMP, or even by command line first. you will then know if you need a username and password for that.

2- check what databases you have. you will know then if the database exists or not.

3- check the database connection string in the project if it's correct or not.

user181452
  • 545
  • 10
  • 25