I am making my first app with Symfony and when i setup my database (doesn’t matter if it’s postgresql or mysql).
I have an error "could not find driver" three time.
One in PDOConnection.php line 38.
Other in Exception.php line 18.
And last one in AbstractMySQLDriver.php line 128.
What i made : i check the php path i also check all the extensions. I check if i fill correctly .env and i check those folders.
PHP version : 7.4
And mysql in docker containers: mysql:5.7.
I really have no idea what to do now
UPDATE:
The problem (for me) was the command php bin/console doctrine:database:create
if you have the same problem try symfony doctrine:database:create
2
Answers
Apparently you use Docker, but in your question you mentioned Windows cmd. I suppose, you check PDO extension in your host system, not in container. You need to log into your Docker PHP container and check it there. In Windows Desktop version of Docker there is a button near each container to open command-line interface. You also can use command:
To find out what your container name is, you can use command
UPDATE:
To start your project not in Docker, bun on Windows-host itself, you can use very helpful mini-server, provided by Symfony. Run this command inside your project directory:
It will start local server, available by default at address https://127.0.0.1:8000/.
However, keep in mind, that if your project requires database, you will need to have MySQL Server for Windows installed on your host system too.
do you use .env file? I have same problem and after a day of disable/enable pdo without any effect, i found that symfony auto add a line to my .env file:
That make my database url wrong and error not found pdo fire because of postgresql not mysql