samedi 27 février 2016

Laravel 5.1 can't find SQLite driver

I'm using NGINX and PHP-FPM to serve a Laravel 5.1 web app with SQLite as my database.

However, I get the exception PDOException in Connector.php line 55: could not find driver when my web app tries to create a new user (from the browser). Figured i forgot to install/enable some sqlite packages... however:

I verified that SQLite was installed: dpkg --get-selections | grep sqlite

libsqlite0                  install
libsqlite3-0:amd64          install
php5-sqlite                 install
sqlite3                     install

Then checked if sqlite was enabled with php -m:

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imagick
intl
json
libxml
mbstring
mhash
openssl
pcntl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3 <--- there it is!
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

Made sure I set permissions correctly with: sudo chmod 775 database.sqlite

Also tried running php artisan tinker to see if i could reproduce the error on the server:

\App\User::firstOrCreate(array('id' => 'afasdfadsf', 'name' => 'Matthew Mitchener', 'email' => 'mattjmitchener@gmail.com'));

Output:

App\User {#719
   id: "afasdfadsf",
   name: "Matthew Mitchener",
   email: "mattjmitchener@gmail.com",
   updated_at: "2016-02-27 16:01:25",
   created_at: "2016-02-27 16:01:25",
}

So it seems to work fine. I am running this as a root user, perhaps that is part of the problem? I don't what else i can try.

Halp! :(

Aucun commentaire:

Enregistrer un commentaire