Laravel 从 sqlite DB 登录,得到“PDOException 找不到驱动程序”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26485331/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel login from sqlite DB, getting "PDOException could not find driver"
提问by Deividas Pranaitis
I am trying to write a simple login form using Laravel and sqlite DB on localhost (vagrant and virtualbox). However, after entering username and passoword I keep getting "PDOException could not find driver" error. Any ideas?
我正在尝试在本地主机(vagrant 和 virtualbox)上使用 Laravel 和 sqlite DB 编写一个简单的登录表单。但是,在输入用户名和密码后,我不断收到“PDOException 找不到驱动程序”错误。有任何想法吗?
--- EDIT ---
- - 编辑 - -
Had to install sqlite driver by typing
必须通过键入安装 sqlite 驱动程序
sudo apt-get install php5-sqlite
in my terminal window. It was somehow not enabled by default :/
在我的终端窗口中。默认情况下它以某种方式未启用:/
采纳答案by Alan Storm
It sounds like your version of PHP is either missing, or has disabled, the PDO extension. Use the phpinfo
function to list out the extensions installed and enabled. If PDO isn't there, look for a commented line in your php.ini
file(s) and/or talk to the person maintaining your servers.
听起来您的 PHP 版本缺少或禁用了 PDO 扩展。使用该phpinfo
函数列出已安装和启用的扩展。如果 PDO 不存在,请在您的php.ini
文件中查找注释行和/或与维护您的服务器的人员交谈。
回答by Leo Harsha El Ni?o
Your system has missing php SQLite installation.
您的系统缺少 php SQLite 安装。
Install it by using:
使用以下命令安装它:
sudo apt-get install php7.0-sqlite