This sort of work, you need to enable microsoft's repo first otherwise you won't be able to install msodbcsql
. For CentOS7 it is:
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo
And after you are done, you will have to use PDO instead of sqlsrv to connect.