- Plesk Onyx for Linux
It is required to connect to SQLServer(MSSQL) databases via PHP script on Linux systems.
What extension should be installed and how it can be done?
Note: These extensions were not officially tested with Plesk and they are not officially supported. Perform all operations at your own risk.
should be enabled for PHP engine. Check the Microsoft documentation to find installation steps for Linux-distributions - Installing the Microsoft ODBC Driver for SQL Server on Linux and macOS
As an example, here are instructions for PHP 7.0, Ubuntu 16.04:
Connect to the server using SSH
Once connected perform the following steps:
# apt-get install apt-transport-https gcc plesk-php70-dev
# curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
# curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
# apt-get update
# ACCEPT_EULA=Y apt-get install msodbcsql
# /opt/plesk/php/7.0/bin/pecl install pdo_sqlsrv
# echo "extension=pdo_sqlsrv.so" > /opt/plesk/php/7.0/etc/php.d/pdo_sqlsrv.ini
# /opt/plesk/php/7.0/bin/pecl install sqlsrv
# echo "extension=sqlsrv.so" > /opt/plesk/php/7.0/etc/php.d/sqlsrv.ini
Check that modules are enabled:
# /opt/plesk/php/7.0/bin/php -m | grep sqlsrv