Reputation: 477
im working with symfony and when i type in console this:
php app/console doctrine:schema:create
i have the next errors
[Doctrine\DBAL\Exception\DriverException]
An exception occured in driver: could not find driver
[Doctrine\DBAL\Driver\PDOException]
could not find driver
[PDOException]
could not find driver
I've been following this link in order to sort it out
PDOException “could not find driver” in php
this is what i get when i run php -m
root@asus-K53SD:/opt/lampp/htdocs/symfonycurso# php -m
[PHP Modules]
calendar
Core
ctype
date
dom
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
openssl
pcntl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlr eader
xmlwriter
xsl
Zend OPcache
zlib
Zend Modules
Zend OPcache
i uncommented this and restart the server
extension=php_pdo_pgsql.dll
this is my parameter.yml
Added database_driver : pdo_mysql and password removed (before was null)
# This file is auto-generated during the composer install parameters: database_driver : pdo_mysql database_host: 127.0.0.1 database_port: database_name: blog database_user: root database_password: mailer_transport: smtp mailer_host: 127.0.0.1 mailer_user: mailer_password: secret: ThisTokenIsNotSoSecretChangeIt
anyone know how can i fix this errors?? can be the problem that im working on PHP7
NOTE: Using lampp on linux
Upvotes: 5
Views: 16820
Reputation: 539
It generally happens when symfony does not find the driver to connect to mysql. for me i had no mysql driver installed so i did following in my terminal :
// I have php version 7.2
sudo apt-get install php7.2-mysql to install the mysql
then i ran following in my terminal to create database
php bin/console doctrine:database:create
which worked perfectly. I hope this does help to some one having similar problem
Upvotes: 0
Reputation: 91
Using LAMP you don't need to enable php_pdo_mysql.dll in the .ini file. Instead, run this below command in cli,
sudo apt-get install php7.0-mysql
(Use specific PHP version which you used).
Now you can see pdo_mysql
module by running php -m
command.
Then, you clear the cache in symfony and run the symfony commands.
Upvotes: 7
Reputation: 347
Check your php version and versions your modules for php. I had problem after php update from 7.0 to 7.1. PHP migrate should help you. For exmaple http://php.net/manual/en/migration71.php
Upvotes: 0