I'm trying to connect to my database in SQL Server 2000, but i get an error
could not find driver
when i'm using pdo_sqlsrv. But if i use sqlsrv i get an error
Attempted to call function "sqlsrv_configure" from namespace "Doctrine\DBAL\Driver\SQLSrv".
Here is my config.yml
config.yml
doctrine:
dbal:
default_connection: default
connections:
default:
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
host: "%database_host%"
driver: pdo_mysql
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
connection2:
dbname: "%database_name2%"
user: "%database_user2%"
password: "%database_password2%"
host: "%database_host2%"
driver: pdo_sqlsrv
#driver: sqlsrv i've also tried this
#charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
Does anybody know why i'm getting these errors?
Can you try:
Not sure if that will work, but try it.
If the function sqlsrv_configure can't be found, then the sqlsrv extension isn't installed. It can be found on the official Microsoft repository here.
You can check if you've installed the extension by running the command
php -m
in your terminal. Note that if you're running Symfony on a standalone server (eg MAMP, XAMP, or anything else that uses a non-CLI version of PHP) then the extensions used by the CLI and the standalone server may differ.You can test this by going to the profiler in Symfony (
/_profiler
by default) and clicking on the "View full PHP configuration" link under theConfiguration
menu item. This will open thephpinfo()
screen. Look for either thesqlsrv
orpdo_sqlsrv
extensions there.EDIT
Looking at the Doctrine docs again, it seems that
pdo_sqlsrv
causes problems. Doctrine recommends usingsqlsrv
.(Emphasis not mine)