以下是linux环境下 快捷安装 sqlsrv 拓展教程，还有安装过程中遇到的一些奇葩坑第一步使用pecl安装sqlsrv拓展sudo pecl install pdo_sqlsrv sudo pecl install sqlsrv期间你可能会遇到这个报错WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to解决办法sudo pecl channel-update pecl.php.net甚至你执行上一句命令的时候还会蹦出此错误Read-only file system解决办法sudo mount -uw /第二步 修改php配置文件把下面这两坨配置信息复制到php.ini最后一行保存即可extension=sqlsrv.so extension=pdo_sqlsrv.so第三步 安装sqlsrv odbc详细见 微软官方文档sudo su curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - #Download appropriate package for the OS version #Choose only ONE of the following, corresponding to your OS version #Ubuntu 16.04 curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list #Ubuntu 18.04 curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list #Ubuntu 19.10 curl https://packages.microsoft.com/config/ubuntu/19.10/prod.list > /etc/apt/sources.list.d/mssql-release.list exit sudo apt-get update sudo ACCEPT_EULA=Y apt-get install msodbcsql17 # optional: for bcp and sqlcmd sudo ACCEPT_EULA=Y apt-get install mssql-tools echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc source ~/.bashrc # optional: for unixODBC development headers sudo apt-get install unixodbc-dev链接sqlsrv时可能会遇到到一些奇葩问题sqlserver目标版本tls版本不支持具体表现为此报错sqlsrv error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol解决办法：拉高本地openssl版本RUN apt-get update -yqq \ && apt-get install -y --no-install-recommends openssl \ && sed -i 's,^\(MinProtocol[ ]*=\).*,\1'TLSv1.0',g' /etc/ssl/openssl.cnf \ && sed -i 's,^\(CipherString[ ]*=\).*,\1'DEFAULT@SECLEVEL=1',g' /etc/ssl/openssl.cnf\ && rm -rf /var/lib/apt/lists/*