How to install 'sqlsrv' extension for Plesk PHP handlers?

Follow

Comments

6 comments

  • Avatar
    Systems Galileu

    Hello!
    I try to install php-mssql on a older php version (5.4), but it not woks. The extensio msssql not apear in Settings for 5.4.45 FPM application

    After run 
    # yum install php-mssql
    it shows 
    Package php-mssql-5.4.16-9.el17.x86_64 already installed and latest version

    I don't know the next step.
    Can anyone help me to solve this?
    Thanks

    Marc

    1
    Comment actions Permalink
  • Avatar
    Systems Galileu

    Hello again!
    I just try also install sqlsrv extension for the Plesk on centos 7 for php 7.2. I follow all steps and I can see de modules are available but when I try to connecte to remote SQL Server it returns this error:

     [SQLSTATE] => IMSSP
     [code] => -49
     [message] => This extension requires the Microsoft ODBC Driver for SQL Server. Access the following URL to download the ODBC Driver for SQL Server for x64: https://go.microsoft.com/fwlink/?LinkId=163712C

    Can anyone help and explain me the next step? What I need to install now?
    Thanks

    1
    Comment actions Permalink
  • Avatar
    Butch Tribbiani (Edited )

    Systems Galileu any luck? I am in the same spot...

    I have checked I have the ODBC driver in latest version:

    Package unixODBC-2.3.11-1.rh.x86_64 already installed and latest version

    1
    Comment actions Permalink
  • Avatar
    Butch Tribbiani

    I checked and have ini files for php7.2 in /opt/plesk/php/7.2/etc/php.d: odbc.ini

    from console (php cli) also says that I have ODBC Driver 18 for SQL Server]

    unixODBC 2.3.11
    DRIVERS............: /etc/odbcinst.ini
    SYSTEM DATA SOURCES: /etc/odbc.ini
    FILE DATA SOURCES..: /etc/ODBCDataSources
    USER DATA SOURCES..: /root/.odbc.ini

    but when trying to connect it says 

    This extension requires the Microsoft ODBC Driver for SQL Server. Ac

    Why is that ? Am i missing something?

     

    1
    Comment actions Permalink
  • Avatar
    Butch Tribbiani (Edited )

    I got it work.

    And this answer is confusing- in example it is sugessted to install Microsoft ODBC 18 (msodbcsql18) and sqlsrv-5.8.1 for PHP 7.2 - and that will not work together.

    Double check versions of drivers to be sure that they can work together. As it turned out - it is very important.

    Check here if you use good version of ODBC Drivers to work with PHP sqlsrv.

    For sqlsrv-5.8.1 you need to use Microsoft ODBC 17

    Further info how to install it is on MS docs site here

    So in step 2 should be added:

    For PHP 7.2 and pdo_sqlsrv-5.8.1 install msodbcsql17 :

    # curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/mssql-release.repo
    
    # sudo yum remove unixODBC-utf16 unixODBC-utf16-devel #to avoid conflicts
    # sudo ACCEPT_EULA=Y yum install -y msodbcsql17
    
    # sudo ACCEPT_EULA=Y yum install -y mssql-tools
    # echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
    # source ~/.bashrc
    
    # sudo yum install -y unixODBC-devel
    
    1
    Comment actions Permalink
  • Avatar
    Miha Gregors

    Hello,

    I notice that for Almalinux 8 is CentOS 7 repo used? Is this ok? I mean this section "CentOS 7/Centos 8/Almalinux 8 with Plesk PHP 8.0/7.3/7.4"
    And there is only this repo for all https://packages.microsoft.com/config/rhel/7/prod.repo

    Regards,

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request