Skip to content
  • Solutions
    By Role
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    By Infrastructure
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
  • Product
    • Plesk Features
    • Plesk Editions
    • What’s new
    • Pricing
    • Roadmap
    • Lifecycle Policy
    • Extensions Catalogue
  • Pricing
  • Extensions
    Featured Extensions
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    Bundles and packs:
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack

    See all Extensions

  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
Plesk 360 login
Free Trial

Knowledge Base

 How to install ‘sqlsrv’ extension for Plesk PHP handlers?

 
almalinuxcentoscloudlinuxdebianextensions

Question

It is required to connect to Microsoft SQL Server (MS SQL) databases via PHP script on a Plesk for Linux server.

What extension should be installed and how it can be done?

Answer

PHP extensions sqlsrv and pdo_sqlsrv should be installed and enabled for PHP handlers:

Warning: These extensions were not properly tested with Plesk and are not officially supported. Perform all operations at your own risk.

Warning: These extensions do not yet support operating systems AlmaLinux/RHEL 9, Debian 12, Ubuntu 24.04.

Note: These extensions are only for PHP 7.x and 8.x.
Instructions cover only operating systems supported both by Plesk and PHP extensions sqlsrv and pdo_sqlsrv:
-CentOS/RHEL/CloudLinux 7.x
-AlmaLinux/RHEL/CloudLinux/Rocky Linux 8.x
-Debian 10, 11
-Ubuntu 18.04, 20.04, 22.04

  1. Connect to the server using SSH.

  2. Install necessary packages:

    • on CentOS/AlmaLinux/RHEL/CloudLinux/Rocky Linux:

      # yum install unixODBC-devel make gcc-c++ gcc autoconf automake libtool-ltdl.x86_64 libtool-ltdl-devel.x86_64 plesk-phpXX-devel

      Note: "XX" in plesk-phpXX-devel should be replaced with the PHP version. For example, "74" for PHP 7.4, or "82" for PHP 8.2.

    • on Ubuntu and Debian:

      # apt install apt-transport-https make gcc g++ unixodbc unixodbc-dev plesk-phpXX-dev

      Note: "XX" in plesk-phpXX-dev should be replaced with the PHP version. For example, "74" for PHP 7.4, or "82" for PHP 8.2.

  3. Install Microsoft ODBC driver for SQL Server on which PHP extensions sqlsrv and pdo_sqlsrv rely on to handle the low-level communication with SQL Server:

    • on CentOS/AlmaLinux/RHEL/CloudLinux/Rocky Linux:

      # curl https://packages.microsoft.com/config/rhel/X/prod.repo > /etc/yum.repos.d/mssql-release.repo
      # yum remove unixODBC-utf16 unixODBC-utf16-devel
      # ACCEPT_EULA=Y yum install msodbcsql18

      Note: replace "X" in the curl command with "7" or "8" depending on the major version of used operating system.

    • on Ubuntu and Debian:

      Note: The below example is for Ubuntu 22.04. If another Ubuntu or Debian version is used, replace the highlighted URL part accordingly, with, for example, "ubuntu/20.04" for Ubuntu 20.04, or "debian/10" for Debian 10.

      # curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
      # curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
      # apt update
      # ACCEPT_EULA=Y apt install msodbcsql18

  4. Install PHP extensions sqlsrv and pdo_sqlsrv:

    • for PHP versions 7.3 and later in Plesk Obsidian 18.0.49 and later: in the Plesk interface by following instructions from the article How to install PECL packages in Plesk?

      Note: Extensions can be installed using only their names sqlsrv and pdo_sqlsrv only for PHP 8.1-8.3.
      For PHP versions 7.3-8.0, specific versions of the extensions must be specified in a dialog window which appears after clicking Install package:
      sqlsrv-5.9.0 for PHP 7.3
      sqlsrv-5.10.1 for PHP 7.4
      sqlsrv-5.11.1 for PHP 8.0
      sqlsrv-5.11.1 on Ubuntu 18.04 and with PHP 8.1-8.3.

      Note: Plesk PHP handler 7.3 is available only on CentOS/RHEL/CloudLinux 7.x, AlmaLinux/RHEL/CloudLinux/Rocky Linux 8.x, Ubuntu 18.04, 20.04, and Debian 10.

    • for PHP versions 7.0-7.2:

      # /opt/plesk/php/7.X/bin/pecl install pdo_sqlsrv-5.X.X
      # echo "extension=pdo_sqlsrv.so" > /opt/plesk/php/7.X/etc/php.d/pdo_sqlsrv.ini
      # /opt/plesk/php/7.X/bin/pecl install sqlsrv-5.X.X
      # echo "extension=sqlsrv.so" &gt…

Tweet
Share
Share
Email
0 Shares
Read the full article
Related Posts

WP Toolkit 6.2 Release Now Available

Read More »

Recommended OSs for Plesk

Read More »

Getting Started With Plesk Extensions & Tools

Read More »
Knowledge Base

How to upgrade MySQL 5.5 to 5.6/5.7 or MariaDB 5.5 to 10.x on Linux

Read More »

How to add Composer to a chrooted environment in Plesk?

Read More »

How to run Composer with Plesk PHP

Read More »

Mail accounts cannot log into Plesk web interface if password is encrypted

Read More »

Hosting Wiki

  • DBMS Interface
  • Server Redundancy
  • Linux Containers
  • PostgreSQL
  • Bare Metal Server
  • MySQL
  • PhpMyAdmin
  • phpPgAdmin
  • Oracle VM Server
  • Server Virtualization Software
  • Windows Server
  • Linux
  • PHP
  • MSSQL
  • SQL
  • Plesk
  • SQL database
  • NoSQL Database
  • Web Server
  • DNS Server
  • SSH
  • URL
  • HTTP
X-twitter Linkedin Youtube Reddit Github
  • Product
  • Login
  • Pricing
  • Editions
  • For Partners
  • Partner Program
  • Contributor Program
  • Affiliate Program
  • Plesk University
  • Company
  • Blog
  • Careers
  • Events
  • About Plesk
  • Our Brand
  • Resources
  • User and Admin guides
  • Help Center
  • Migrate to Plesk
  • Contact Us
  • Hosting Wiki
  • Forum
  • Legal
  • Legal
  • Privacy Policy
  • Imprint

© 2025 WebPros International GmbH

Part of the WebPros®  Family