php7.3 centos7.9安装sqlserver扩展

一、安装sql server驱动(直接yum准备)

yum install msodbcsql mssql-tools unixODBC-devel

二、安装sqlsrv,pdo_sqlsrv

wget https://pecl.php.net/get/pdo_sqlsrv-5.6.1.tgz && wget https://pecl.php.net/get/sqlsrv-5.6.1.tgz
tar -zxvf pdo_sqlsrv-5.6.1.tgz && tar -zxvf sqlsrv-5.6.1.tgz
cd sqlsrv-5.6.1
/www/server/php/73/bin/phpize
./configure --with-php-config=/www/server/php/73/bin/php-config
make && make install
cd pdo_sqlsrv-5.6.1
/www/server/php/73/bin/phpize
./configure --with-php-config=/www/server/php/73/bin/php-config
make && make install

三、php.ini中加入扩展,

echo “extension = sqlsrv.so” >> path\php.ini
echo “extension = pdo_sqlsrv.so” >> path\php.ini

四、检查是否安装成功

php -m|grep -i  sqlsrv

五、安装ODBC Driver,安装17版本可用,注意是linux还是windows

https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017&tabs=alpine18-install%2Calpine17-install%2Cdebian8-install%2Credhat7-13-install%2Crhel7-offline

发表评论