Yii “CDbConnection failed to open the DB connection: could not find driver"解决办法

来源:互联网 发布:瓦尔登湖 知乎 译本 编辑:程序博客网 时间:2024/06/05 19:54
在按照Yii文档做自己的第一个例子的时候,在创建Model的页面出现“CDbConnection failed to open the DB connection: could not find driver"错误,其中数据库自己使用的sqlite数据库。
出现这个问题后突然想起在安装完Yii时,文档里给了一个测试页面(http://localhost/yii/requirements/index.php),可以查看Yii的依赖检查,再次查看这个页面发现“PDO SQLite extension”的检查结果是Warning,于是想是不是自己没有按照php的sqlite pdo包,于是使用以下命令安装了sqlite包并重启了apache服务
sudo apt-get install php5-sqlite php-pear php-dbsudo /etc/init.d/apache2 restart
再次访问http://localhost/yii/requirements/index.php页面,发现其中的Waring已经Passed状态了。再次访问创建Model页面,也可以创建Model了。
原创粉丝点击