PHP MS SQL Unix Driver - Microsoft or FreeTDS

前端 未结 2 661
清酒与你
清酒与你 2020-12-18 08:50

I am running a LAMP server but now need to connect to MS SQL (client request). I have heard Microsoft has a driver, but can\'t verify if

Does anyone know if the Mic

相关标签:
2条回答
  • 2020-12-18 09:17

    FreeTDS is fine and works well enough. The Microsoft driver is Windows only, thus you wouldn't be able to use it on your Linux server.

    First install FreeTDS and then configure PHP with --with-mssql=/prefix/used/for/freetds. If you are using your distribution's PHP, I'm sure there is a MS-SQL driver package already precompiled and available for installation (in Ubuntu, that'd be php5-sybase).

    Then use PHP's mssql_* functions to actually do the work

    0 讨论(0)
  • 2020-12-18 09:20

    For anyone who comes across this rather old question...

    It should be noted that since 2010, Microsoft has actually developed a viable Linux driver for SQL Server that is installable via PECL. It's currently only compatible with PHP 7.

    The main readme file is here, which lists some general and overly complicated installation instructions. But if you look at the latest release notes you will see that newer versions can be installed via PECL like so:

    sudo pecl install sqlsrv
    sudo pecl install pdo_sqlsrv
    
    0 讨论(0)
提交回复
热议问题