Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony3 demo project don't work: PDO Exception Could not find driver (sqlite case)

Recently i've created Symfony3 project by command:

symfony new myproject

The project uses mysql and it works fine.

After that i've created demo project to study symfony best practices:

symfony demo

Project was created successfully. Config.php shows, that everything is ok. app_dev.php was successfully opened in my web browser. But when i try to open "http://localhost/app_dev.php/ru/blog/" (there is a public part of the app) 500 internal server error will appear. /app_dev.php/ru/blog/ shows:

Error message:

An exception occured in driver: could not find driver

500 Internal Server Error - DriverException

2 linked Exceptions:

PDOException »

PDOException »

Critical part in call stack:

CRITICAL - Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: "An exception occured in driver: could not find driver" at /var/www/symfony_demo/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php line 85

I've read all stack exchange issues about PDO Exception, but none helps me...

I use Ubuntu, Nginx.

Mysql, sqlite, php5-sqlite, sqlite3, libsqlite3-dev are installed. Nginx and php5-fpm are restarted. php.ini SQLite 3.x driver for PDO Wez Furlong.

Demo app parameters.yml:

database_driver: pdo_sqlite
database_host: 127.0.0.1
database_port: null
database_name: null
database_user: root
database_password: null
database_path: '%kernel.root_dir%/data/blog.sqlite'
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
locale: en
secret: secret_value_for_symfony_demo_application

php.ini file:

[sqlite]
; http://php.net/sqlite.assoc-case
;sqlite.assoc_case = 0

[sqlite3]
;sqlite3.extension_dir =

I have no idea, what is the reason of the problem and how to resolve it.

Help please!

like image 402
Andrew Avatar asked Nov 30 '22 23:11

Andrew


1 Answers

Just install:

sudo apt install php-sqlite3
like image 130
Pavel Novák Avatar answered Dec 04 '22 09:12

Pavel Novák