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
Pdo ( Portable Data Object ) needs to be installed if it is not done before. For windows platform go to control panel > Add remove program ( or Programs and features ) > Select your PHP installation and click Change. If you are installing PHP fresh then in the setup wizard you can select PDO from Extensions link.
If you see "PDOException : could not find driver" in your error logs, that means the SQLite PDO driver is not installed on your server. The SQLite PDO driver is listed as a prerequisite in the help article " Verify your prerequisites".
PDO_MYSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MySQL databases. PDO_MYSQL uses emulated prepares by default. MySQL 8. When running a PHP version before 7.1. 16, or PHP 7.2 before 7.2.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With