Ubuntu22.04 php7.3 sqlsrv 部署教程

永远的零 2024-06-29 AM 425℃ 0条

https://github.com/microsoft/msphpsql/releases/tag/v5.9.0


sudo pecl install sqlsrv-5.9.0
sudo pecl install pdo_sqlsrv-5.9.0

https://learn.microsoft.com/zh-cn/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver16&tabs=ubuntu18-install%2Cubuntu17-install%2Cubuntu16-install%2Credhat7-13-install%2Crhel7-offline#ubuntu17

if ! [[ "16.04 18.04 20.04 22.04" == *"$(lsb_release -rs)"* ]];
then
    echo "Ubuntu $(lsb_release -rs) is not currently supported.";
    exit;
fi

curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc

curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list

sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo apt-get install -y unixodbc-dev

安 装php_mongodb扩展,我502装这个就好了,神奇!

SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:0A000102:SSL routines::unsupported protocol]
 /etc/ssl/openssl.conf 中的最后一行更改为:
[system_default_sect]
CipherString = DEFAULT:@SECLEVEL=0

人要么永不做梦,要么梦得有趣;人也必须学会清醒:要么永不清醒,要么清醒得有趣。

评论啦~