当前位置:网站首页>php7.3 centos7.9安装sqlserver扩展
php7.3 centos7.9安装sqlserver扩展
2022-06-30 15:47:00 【BookNoteY】
php7.3 centos7.9安装sqlserver扩展
安装sql server驱动(直接yum准备)
yum install msodbcsql mssql-tools unixODBC-devel
到php扩展官网选择 要按照的sqlsrv,pdo_sqlsrv版本
sqlsrv 版本选择:https://pecl.php.net/package/sqlsrv
pdo_sqlsrv 版本选择:https://pecl.php.net/package/pdo_sqlsrv
查看每个版本对应详情:https://pecl.php.net/package-changelog.php?package=sqlsrv&release=5.10.1
安装扩展 这里安装5.6.1
下载源码包 cd到你下载的位置
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
编译安装
# pdo_sqlsrv
cd pdo_sqlsrv-5.6.1
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
# pdo_sqlsrv
cd pdo_sqlsrv-5.6.1
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
修改配置文件并重启php
vim /usr/local/php/etc/php.ini
#到后面加入两行,引入扩展文件
extension=sqlsrv.so
extension=pdo_sqlsrv.so
#重启fpm, 我这里用的lnmp
lnmp restart
不要忘记重启你的php或php-fpm
查看是否安装成功,一般上面没有报错应该都会成功
php -m |grep sqlsrv
存在则成功
番外篇
如果遇到这样的问题
In file included from/root/sqlsrv-5.6.1/shared/typedefs for linux.h:23:0
from /root/sqlsrv-5.6.1/shared/xplat winnls.h:24, from /root/sqlsrv-5.6.1/shared/FormattedPrint.h:24
from /root/sqlsrv-5.6.1/shared/core sqlsrv.h:41, from /root/sqlsrv-5.6.1/php solsrvint.h:25
from /root/sqlsrv-5.6.1/conn.cpp:24:
/root/sqlsrv-5.6.1/shared/xplat.h:30:17: fatal error: sql.h: No such file or directory#include <sql.h>
应该就是你没有安装sqlserver驱动就安装的扩展,编译时就会报错
安装第一步的驱动后重新编译就可以解决
边栏推荐
- Tencent two sides: @bean and @component are used on the same class. What happens?
- I implement "stack" with C I
- Dart: string replace related methods to solve replacement characters
- 从第三次技术革命看企业应用三大开发趋势
- What is XR extended reality and what are the XR cloud streaming platforms
- Half year inventory of new consumption in 2022: the industry is cold, but these nine tracks still attract gold
- 云和恩墨中标天津滨海农村商业银行2022-2023年度Oracle维保项目
- Solution for IIS failing to load font files (*.woff, *.svg)
- Implementation of Devops in the core field of qunar, the Internet R & D Efficiency
- 云技能提升好伙伴,亚马逊云师兄今天正式营业
猜你喜欢
随机推荐
招标公告:深圳市财政局数据库异地灾备项目
从第三次技术革命看企业应用三大开发趋势
Does flinkcdc have to be a clustered version if the monitored database is Mongo
招标公告:天津市住房公积金管理中心数据库一体机及数据库软件项目(预算645万)
药品管理系统加数据库,一夜做完,加报告
What role does "low code" play in enterprise digital transformation?
Build cloud native observability capability suitable for organizations
RT-Thread 堆區大小設置
What are the reasons for the errors reported by the Flink SQL CDC synchronization sqlserver
What is the difference between real-time rendering and pre rendering
什么是XR扩展现实,XR云串流平台有哪些
Symantec electronic sprint technology innovation board: Tan Jian, the actual controller, is an American who plans to raise 620million yuan
[Verilog basics] summary of some concepts about clock signals (clock setup/hold, clock tree, clock skew, clock latency, clock transition..)
搬运两个负载均衡的笔记,日后省的找
RT thread heap size setting
2020 Blue Bridge Cup group B - move bricks - (greedy sorting +01 backpack)
牛客网:最小花费爬楼梯
备战数学建模36-时间序列模型2
Distributed machine learning: model average Ma and elastic average easgd (pyspark)
Mysql8.0 method and steps for enabling remote connection permission









