Reputation: 6269
After deploying the app, I changed my env file to match the connection credentials for the sql server which was up and already running.
There is an error when I visit the website
> PDOException in Connector.php line 55: could not find driver in
> Connector.php line 55 at
> PDO->__construct('sqlsrv:Server=xxxx.database.windows.net;Database=xxxx', 'xxxx@xxxx', 'xxxxxx', array('0', '2', '0', false)) in Connector.php
> line 55
I tried opening the console from azure portal and write php artisan migrate
, it showed the same error.
Anyone knows how can i manage to make this work?
Upvotes: 3
Views: 4811
Reputation: 13918
Have you enabled the php_sqlsrv
and php_pdo_sqlsrv
extension on Azure? You can use phpinfo()
to check the variables and extensions of your PHP runtime on Azure.
Be default, the DLL libraries php_sqlsrv
and php_pdo_sqlsrv
have been installed in the PHP ext folder on Azure, but haven't been configured in PHP runtime. So we need to configure the extensions manually:
Create a file named .user.ini
at the root directory of your application on Azure.
Write the following content in .user.ini
:
extension=php_pdo_sqlsrv.dll
extension=php_sqlsrv.dll
Restart your application. Check the extension of sqlsrv
and pdo_sqlsrv
again.
As the libraries sqlsrv
and pdo sqlsrv
for PHP 7 are available now. Please try the following to enable the sqlsrv extension for PHP 7 on Azure Web Apps:
msphpsql-PHP-7.0\binaries\x86
you unzip before, and use php_sqlsrv_7_nts.dll
and php_pdo_sqlsrv_7_nts.dll
)Any further concern, please feel free to let me know.
Upvotes: 3