Install SQLSRV driver on Linux, or other UTF-8 capable driver?

前端 未结 4 1135
长情又很酷
长情又很酷 2021-01-12 04:42

SQLSRV is the only driver for PHP that is capable of storing UTF-8 strings into two-byte columns (NVARCHAR instead of VARCHAR) which is cu

相关标签:
4条回答
  • 2021-01-12 04:51

    Other UTF-8 compatible solution dblib:

    1. You install freetds and use php-mssql driver with PDO.

    2. Change encoding in /etc/freetds.conf

    3. Change charset and date format in /etc/locales.conf

    I did it back in 2010.

    0 讨论(0)
  • 2021-01-12 04:58

    Here's a wiki post from the Microsoft Community

    https://github.com/Microsoft/msphpsql/wiki/Install-pdo_sqlsrv-for-PHP-7.0-on-Debian

    I think the easiest route would be the php-pear route

    # (1) Install PDO driver from pecl
    apt-get install unixodbc-dev php7.0-dev php-pear
    pecl install pdo_sqlsrv-4.0.5
    echo -e "; priority=20\nextension=pdo_sqlsrv.so" > /etc/php/7.0/mods-available/pdo_sqlsrv.ini
    phpenmod -v 7.0 pdo_sqlsrv
    
    0 讨论(0)
  • 2021-01-12 05:10

    Please change:

    echo -e "; priority=20\nextension=pdo_sqlsrv.so" > /etc/php/7.0/mods-   available/pdo_sqlsrv.ini
    

    to:

    echo -e "; priority=20\nextension=pdo_sqlsrv.so" > /etc/php/7.0/mods-available/pdo_sqlsrv.ini
    
    0 讨论(0)
  • 2021-01-12 05:11

    I Googled a bit more after I read this and I may have found the answer. On Debian:

    # apt-get install freetds-common freetds-bin unixodbc php5-mssql
    

    That will install everything PHP needs for Free TDS and allows me to connect using the sqlsrv driver.

    0 讨论(0)
提交回复
热议问题