After installing the sql server, I tried to install the php drivers, sqlsrv and pdo_sqlsrv php extensions, following these commands:
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
sudo su
printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/7.4/mods-available/sqlsrv.ini
printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/7.4/mods-available/pdo_sqlsrv.ini
exit
sudo phpenmod -v 7.4 sqlsrv pdo_sqlsrv
But I am getting this PHP Warning:
PHP Warning: PHP Startup: Unable to load dynamic library 'sqlsrv.so' (tried: /usr/lib/php/20190902/sqlsrv.so (/usr/lib/php/20190902/sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/sqlsrv.so.so (/usr/lib/php/20190902/sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlsrv.so' (tried: /usr/lib/php/20190902/pdo_sqlsrv.so (/usr/lib/php/20190902/pdo_sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/pdo_sqlsrv.so.so (/usr/lib/php/20190902/pdo_sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
And then when I try to migrate my database using the sql server throws an error saying that can`t find sql driver.
Illuminate\Database\QueryException : could not find driver (SQL: select * from sysobjects where type = 'U' and name = migrations)
Does anyone have any idea how to solve? I use Ubuntu 18.04 and PHP version 7.4.10
Finally got it to work. You need to set the cli version to 7.4
This perfectly worked in ubuntu 18.04