当前位置:网站首页>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驱动就安装的扩展,编译时就会报错
安装第一步的驱动后重新编译就可以解决
边栏推荐
- 2022新消费半年盘点:行业遇冷,但这九个赛道依然吸金
- Halcon knowledge: matrix topic [02]
- dart:字符串replace相关的方法解决替换字符
- MySQL proxy middleware atlas installation and configuration
- Build cloud native observability capability suitable for organizations
- Headhunter 50, 000, I'll go to VC
- [Verilog quick start of Niuke online question series] ~ bit splitting and operation
- 快照和备份
- Solution for IIS failing to load font files (*.woff, *.svg)
- In depth analysis of the core code of the gadgetinspector
猜你喜欢

Raft介绍

中航无人机科创板上市:市值385亿 拳头产品是翼龙无人机

Half year inventory of new consumption in 2022: the industry is cold, but these nine tracks still attract gold

RT thread heap size Setting

云化XR,如何助力产业升级

I implement "stack" with C I

Compulsory national standard for electronic cigarette GB 41700-2022 issued and implemented on October 1, 2022

Li Zexiang, a legendary Chinese professor, is making unicorns in batches
Two methods for MySQL to open remote connection permission
MySQL8.0开启远程连接权限的方法步骤
随机推荐
RT thread heap size setting
CloudXR如何推动XR的未来发展
“低代码”在企业数字化转型中扮演着什么角色?
MySQL开放远程连接权限的两种方法
Mysql代理中间件Atlas安装和配置
dart:字符串replace相关的方法解决替换字符
超 Nice 的表格响应式布局小技巧
24:第三章:开发通行证服务:7:自定义异常(来表征程序中出现的错误);创建GraceExceptionHandler来全局统一处理异常(根据异常信息,构建对应的API统一返回对象的,JSON数据);
RT-Thread 堆區大小設置
2022蓝桥杯国赛B组-费用报销-(线性dp|状态dp)
MicroBlaze serial port learning · 2
What role does "low code" play in enterprise digital transformation?
MC Instruction Decoder
牛客网:有多少个不同的二叉搜索树
2022新消费半年盘点:行业遇冷,但这九个赛道依然吸金
Wechat emoticons are written into the judgment, and the OK and bomb you send may become "testimony in court"
新茶饮“死去活来”,供应商却“盆满钵满”?
Go zero micro Service Practice Series (VIII. How to handle tens of thousands of order requests per second)
Implementation of Devops in the core field of qunar, the Internet R & D Efficiency
MySQL8.0开启远程连接权限的方法步骤