Symfony中的Php和从命令行运行的php正在加载不同的驱动程序

I am trying to connect to a remote sql server, and have succeeded in doing so from the command line. When running php -i | grep PDOI get

PDO
PDO support => enabled
PDO drivers => sqlsrv, dblib, mysql
PDO Driver for FreeTDS/Sybase DB-lib => enabled
PDO Driver for MySQL => enabled`

When running a php script from the command line, I can connect to the remote DB no problem. When running that exact same code in my Symfony application, I get

[Doctrine\DBAL\Driver\PDOException]                              
SQLSTATE[01002] Adaptive Server connection failed (severity 9) 

When I run phpinfo() in Symfony, the only PDO driver that comes up is mysql

When I run phpinfo() from the command line, I get mysql, sqlsrv, and dblib

Why are some pdo drivers not loading in Symfony?

Edit: The DB is configured properly in Symfony as php bin/console doctrine:query:sql "SELECT * FROM my_table" returns results. The same query executed in Symfony errors with "could not load driver"

Did you mention those pdo drivers in the app/config.yml file in your symfony project ?

You need to tell symfony ( that means write it in the config.yml file ) about those drivers in order for him to recognize and use them.

Check out this topic, it may help you, it is about using a mysql pdo driver and a postgresql pdo driver

Use a postgres database with symfony3