HiveSQL for PHP developers

It is a bit tricky to enable PHP on Linux to work with MS-SQL servers. Here is a procedure for this to work:

  • install php-pdo-dblib (if you're using PDO)

  • then echo "extension=pdo_dblib.so" > /etc/php.d/mssql.ini

  • then restart your httpd

  • you also need the ODBC drivers curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo yum remove unixODBC-utf16 unixODBC-utf16-devel #to avoid conflicts sudo ACCEPT_EULA=Y yum install msodbcsql17 sudo pecl install sqlsrv sudo pecl install pdo_sqlsrv

  • You should add "extension=sqlsrv.so" to php.ini You should add "extension=pdo_sqlsrv.so" to php.ini

Thanks to @drakos for this information.

Last updated