How to install the sqlsrv extension for PHP 7.x?

Follow

Comments

12 comments

  • Avatar
    Daniel

    Note in case someone stumbles across this article: I had to run the reread command for them to show up: https://www.danhendricks.com/2017/11/installing-microsoft-sql-server-php-extensions-plesk-onyx/

  • Avatar
    Bulat Tsydenov

    @Daniel, Thank you for your input! You are right, that command is necessary indeed. The article has been modified accordingly.

  • Avatar
    Noam Harel

    Hi,

    can you make the same proccess for CENTOS?

    i followed this:  https://www.danhendricks.com/2017/11/installing-microsoft-sql-server-php-extensions-plesk-onyx/

    and got some errors

     

    Noam

  • Avatar
    Bulat Tsydenov

    @Noam, Hi!

    The article was updated with the corresponding steps for CentOS 7.

  • Avatar
    Federica Della Monica (Edited )


    Good morning,

    I've installed sqlsrv extension for php 7.0 but I still have PDO Exception driver not found.

  • Avatar
    Ivan Postnikov

    @Federica Della Monica

    Hi!

    Make sure pdo_mysql is also installed and enabled.
    In case you will have difficulties, feel free to contact Plesk Support.

  • Avatar
    Federica Della Monica

    Hi!

    pdo_mysql is installed and enabled. 

    See image below

  • Avatar
    Ivan Postnikov

    @Federica Della Monica

    Hi!
    Due to issue complexity, I would suggest contacting Plesk Technical Support for deeper investigation.

  • Avatar
    Linus (Edited )

    Works also great with PHP 7.3 on Ubuntu / Debian:

    2. Install necessary packages:

    apt-get install apt-transport-https gcc g++ unixodbc unixodbc-dev plesk-php73-dev

     

    4. Add the pdo_sqlsrv and sqlsrv modules:

    # /opt/plesk/php/7.3/bin/pecl install pdo_sqlsrv
    # echo "extension=pdo_sqlsrv.so" > /opt/plesk/php/7.3/etc/php.d/pdo_sqlsrv.ini 
    # /opt/plesk/php/7.3/bin/pecl install sqlsrv 
    # echo "extension=sqlsrv.so" > /opt/plesk/php/7.3/etc/php.d/sqlsrv.ini

     

    6. Make sure that the required modules are enabled:

    # /opt/plesk/php/7.3/bin/php -m | grep sqlsrv

    pdo_sqlsrv 
    sqlsrv

     

     

    Hint for Debian 9:

    In Step 3 just adapt the repo url:

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

     

  • Avatar
    Alexandr Redikultsev

    Hi @Linus!

    Thanks so much for the input!

  • Avatar
    Peter Shaw (Edited )

    Trying this on Ubuntu18.04, Plesk Onyx, PHP7.2.

    Have modified the CURL URL in #3 to reflect Ubuntu18.04

    Struggling with the pecl install commands in #4 which fail with

    running: make
    sh: 1: make: not found
    ERROR: `make' failed

    After adding the Make package the install completed successfully. Is the expectation that Make is available in a default Plesk Onyx install?

  • Avatar
    Ivan Postnikov

    Hello @Peter,

    Plesk is not in charge of this package installation, this depends on the used OS.

    Thank you for sharing your user experience, it may be helpful for other Pleskians.

     

Please sign in to leave a comment.

Have more questions? Submit a request