Home  >  Article  >  Topics  >  How to install sqlsrv extension in Pagoda Panel PHP7.3 under Centos7

How to install sqlsrv extension in Pagoda Panel PHP7.3 under Centos7

藏色散人
藏色散人forward
2021-04-23 16:10:003335browse

The following tutorial column of Pagoda Panel will introduce to you how to install the sqlsrv extension in Pagoda Panel PHP7.3 under Centos7. I hope it will be helpful to friends who need it!

Installing the sqlsrv extension in Pagoda Panel PHP7.3 under Centos7

Originally I chose php7.4, but after configuration, it kept prompting that the dynamic extension could not be loaded. Downgraded to php7.3.
After compiling and installing php7.3, do the following:
Join Microsoft’s source

curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssqlrelease.repo

You can find it at (https://packages.microsoft.com/config/rhel ), find the corresponding required version
Install the driver

#如果安装过,防止冲突可先卸载再安装
yum remove unixODBC

yum install msodbcsql mssql-tools unixODBC-devel

Download the pdo_sqlsrv expansion package, and unzip it

wget http://pecl.php.net/get/pdo_sqlsrv-5.6.1.tgz
tar -zxvf pdo_sqlsrv-5.6.1.tgz
cd pdo_sqlsrv-5.6.1

Use Corresponding php version of phpize

/www/server/php/73/bin/phpize
./configure --with-php-config=/www/server/php/73/bin/php-config
make && make install

Write extension

echo "extension = pdo_sqlsrv.so" >> /www/server/php/73/etc/php.ini
/etc/init.d/php-fpm-73 reload

Check whether it is successful

/www/server/php/73/bin/php -m|grep -i  sqlsrv

View all extensions

php -m

PS: Pay attention to your own PHP version. After installing PHP7.4 many times, it prompts that the dynamic extension cannot be loaded. I hope that successful experts can leave a comment.

The above is the detailed content of How to install sqlsrv extension in Pagoda Panel PHP7.3 under Centos7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete