So, I just started using Doctrine, and it's also my first time using Symfony 5.
I used the Maker bundle to generate my first entity, and I completed the DATABASE_URL in my .env, but I can't generate my database with "php bin/console make:migration".
I got these errors:
In AbstractMySQLDriver.php line 106:
An exception occurred in driver: could not find driver
In PDOConnection.php line 31:
could not find driver
In PDOConnection.php line 27:
could not find driver
I searched for a solution, most of the time it's because the corresponding extension is missing... but not in my case !
This is my DATABASE_URL in my .env. I didn't modified anything else.
DATABASE_URL=mysql://myusername:mypassword#localhost:3306/mydatabase?serverVersion=5.7
I'm a complete newbie, and I'm a bit lost.
Can you help me please ?
Thank you !
EDIT: sorry, I totally forgot the most important. Im on Windows 10 with the last version of WAMP, and I installed PHP 7.4.7.
All the extensions are activated, and php -m return them !
Related
Problem : When i create a new db with cli symfony console doctrine:database:create, i am getting these errors :
extension=mysqli
extension=pdo_mysql
: are free from any ;
i tried every version of php and xampp and still the same problem : i currantly on version 8.1.6 for both php and Xampp i do only have one php.ini in the Xampp/php file and i did try'd to revoume every comment related
the symfony serve is running fine i tried coding in it doing roots every thing is fine in it except database creating
.Xampp is runnig both MySQL and Appache fine as well
i'm using windows 10 .
symfony console doctrine:database:create
In ExceptionConverter.php line 117:
An exception occurred in the driver: could not find driver
In Exception.php line 28:
could not find driver
In Driver.php line 28:
could not find driver
the .env file
DATABASE_URL="mysql://root#127.0.0.1:3306/EspritClub" // i don't have mdp for the phpmyadmin
#DATABASE_URL="postgresql://app:!ChangeMe!#127.0.0.1:5432/app?serverVersion=14&charset=utf8"
Hope i give all the information , i really need to solve this it has been a week now and still nothing changed .
Finally resolve it , So the problem was in the php.ini file i was changing in the one that was in Xampp/php cause i did not have php.ini in the main php file so i just copy paste the php.ini the the main file and it worked .
I'm in linux mint and when I just trying to test my project with phpunit in laravel I get this Error :
Illuminate\Database\QueryException: could not find driver (SQL: PRAGMA foreign_keys = ON;)
and in a few line below this :
PDOException: could not find driver
I'm using mysql.
please help me to fix this problem
Check your phpunit.xml file. The DB_CONNECTION and/or DB_DATABASE environment variables are probably being overruled there.
I'm a fresh junior php developer and I'm building my first Symfony project.
When I used the command : php bin/console doctrine:database:create
I get these errors :
In AbstractMySQLDriver.php line 93:
An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory
In PDOConnection.php line 31:
SQLSTATE[HY000] [2002] No such file or directory
In PDOConnection.php line 27:
SQLSTATE[HY000] [2002] No such file or directory*
I'm actually using MAMP with default config "db_user" and "db_password"
so I edited the .env file with this following code :
DATABASE_URL=mysql://root:root#localhost:8889/mydbname
I know there is something wrong with my host or port, I saw on other topics that some users using MAMP keep Symfony default values for host and port : DATABASE_URL=mysql://root:root#127.0.0.1:3306/mydbname
Thanks for reading me and trying to help me.
I did more searches and some people are saying that localhost syntax is depreciated and prefer using : 127.0.0.1 instead of localhost.
In my case I checked and used Mamp config 'Connect using an UNIX socket'
So it's now working with :
DATABASE_URL=mysql://root:root#127.0.0.1:8889/mydbname
I keep getting this error when trying to execute artisan.
In UdpSocket.php line 47:
socket_sendto(): Host lookup failed [-10001]: Unknown host
The problem seems to be affecting composer as well.
I run Laravel 5.5 on a homestead virtual machine, everything was working as expected until this problem arrived in a very random way.
I really don't know where to start to debug this,
Thanks for the help!
I'm trying to play with Symfony4 and SQlite3.
After:
composer create-project symfony/website-skeleton my-project
and something like LuckyNumber, I try to define DB-connection.
in:
config/packages/doctrine.yaml is:
doctrine:
dbal:
# configure these for your database server
url: '%env(DATABASE_URL)%'
and in .env :
DATABASE_URL="sqlite:///%kernel.project_dir%/db/sqlite3.db3"
Is there any console-command to test connection?
Or maybe:
php bin/console doctrine:query:sql "select * from all_files"
should return resource or something else way to simply test the connection?
Unfortunatelly Google is silent like a grave :-(
How do you test DB connections in Symfony4/Doctrine?
after: php bin/console doctrine:query:sql "select * from all_files"
I got:
In AbstractSQLiteDriver.php line 89:
An exception occurred in driver: could not find driver
In PDOConnection.php line 47:
could not find driver
php7.2-sqlite3-dbgsym is installed and apache2 restarted (but I guess Symfony console do nto use Apache?)...
edit:
after Mike`s prompt, (there wasn't pdo_sqlite for this php ver.) I get:
~/Dokumenty/projects/symfony_mdb/my-project$ php bin/console doctrine:query:sql "select * from all_files"
In AbstractSQLiteDriver.php line 86:
An exception occurred in driver: SQLSTATE[HY000] [14] unable to open database file
In PDOConnection.php line 47:
SQLSTATE[HY000] [14] unable to open database file
but this is new file and none of process using it (I guess). It is possible to open it with SQlite GUI and run query with expected answer...
Yes! I got it!
the problem was in:
config/packages/doctrine.yaml
wrong:
url: '%env(DATABASE_URL)%'
but sholud be:
url: '%env(resolve:DATABASE_URL)%'
Thank you for help!