0
votes

I have been looking for a solution for this for hours now and I found a lot of solutions, but unfortunately none of them worked.
The error I am getting is :


Fatal error: Uncaught PDOException: could not find driver in C:\xampp\htdocs\site\includes\database\sqlsrv\database.inc:124 Stack trace: #0 C:\xampp\htdocs\site\includes\database\sqlsrv\database.inc(124): PDO->__construct('sqlsrv:Server=l...', 'sa', 'PWHERE...', Array) #1 C:\xampp\htdocs\site\includes\database\database.inc(1689): DatabaseConnection_sqlsrv->__construct(Array) #2 C:\xampp\htdocs\site\includes\database\database.inc(1479): Database::openConnection('xilenacc', 'default') #3 C:\xampp\htdocs\site\includes\database\database.inc(2350): Database::getConnection('default') #4 C:\xampp\htdocs\site\includes\lock.inc(167): db_query('SELECT expire, ...', Array) #5 C:\xampp\htdocs\site\includes\lock.inc(146): lock_may_be_available('schema:runtime:...') #6 C:\xampp\htdocs\site\includes\bootstrap.inc(433): lock_acquire('schema:runtime:...') #7 C:\xampp\htdocs\site\includes\bootstrap.inc(455): DrupalCacheArray->set(Array) #8 [internal function]: DrupalCacheArray->__destruct() #9 {main} thrown in C:\xampp\htdocs\site\includes\database\sqlsrv\database.inc on line 124`

This is line 124 at database.inc:

 PDO::__construct($dsn, $connection_options['username'], $connection_options['password'], $connection_options['pdo']);`
    <br>

Information on what I am using:

  • PHP Version: 7.0.25
  • Mssql express 2016
  • Windows Server 2012
  • If I can provide further information, please let me know.

What I tried:

  • Downloading SQLSRV30 from microsoft website and putting the extensions in php -> Result: After putting the dll names in php.ini, I restarted apache and checked phpinfo(), I didn't find sqlsrv.
  • I double checked the information I have in settings.php - they are correct, I even tried changing my sql pw because I thought it might be causing this, but it didn't work.
1
Are you using anything like msphpsql to help PHP talk to your server and SQL db? github.com/Microsoft/msphpsql - slothluvchunk
No I'm not using msphpsql. - Youssef
Are you using anything to let PHP talk to MSSQL? PDO_DBLIB - slothluvchunk
No, I'm not using PDO_DBLib either. I'm not using anything to let PHP talk to MSSQL.. - Youssef

1 Answers

0
votes

Finally after hours of googling, I found a solution that actually worked even though it doesn't look so important.
The solution that worked with me is to install Microsoft Redistributable 2012. Kinda weird but worked!