怎么增加php mssql扩展
2022-12-02 09:01:16
173
{{single.collect_count}}

增加php mssql扩展的方法:1、下载freetds及php源码包;2、安装freetds;3、解压php源码包,并进入mssql扩展目录;4、生成configure;5、编辑php.ini文件,加入mssql扩展即可。

千万级数据并发如何处理?进入学习

本文操作环境:linux5.9.8系统、php-5.2.17版、DELL G3电脑

怎么增加php mssql扩展?

php安装mssql扩展

关于freetds编译时with-tdsver参数

在FreeTDS 1.1版本之后,可以设置为auto,版本之前需要手动指定。

以前写过mssql模块安装,这次只是补充编译freetds时指定with-tdsver参数

1、下载freetds及php源码包

[root@VM_0_11_centos ~]# wget -c ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.1.21.tar.gz[root@VM_0_11_centos ~]# wget -c http://museum.php.net/php5/php-5.2.17.tar.gz
登录后复制

2、安装freetds

# 解压freetds源码包

[root@VM_0_11_centos ~]# tar zxvf freetds-1.1.21.tar.gz[root@VM_0_11_centos ~]# cd freetds-1.1.21/
登录后复制

# 开始编译安装

[root@VM_0_11_centos ~]# ./configure --prefix=/usr/local/freetds --with-tdsver=7.3 --enable-msdblib[root@VM_0_11_centos ~]# make && make install
登录后复制

3、编译mssql模块

# 解压php源码包

[root@VM_0_11_centos ~]# tar zxvf php-5.2.17.tar.gz
登录后复制

# 进入mssql扩展目录

[root@VM_0_11_centos ~]# cd php-5.2.17/ext/mssql/
登录后复制

# 生成configure

[root@VM_0_11_centos mssql]# /www/server/php/52/bin/phpize
登录后复制

# 开始编译

[root@VM_0_11_centos php-5.2.17]# ./configure--with-php-config=/www/server/php/52/bin/php-config --with-mssql=/usr/local/freetds[root@VM_0_11_centos php-5.2.17]# make && make install
登录后复制

4、编辑php.ini文件,加入mssql扩展,在 491 行下面添加(如果不会用vi编辑器,可直接将文件下载改完再传上去)

[root@VM_0_11_centos ~]# vi /www/server/php/52/etc/php.iniextension_dir = "/www/server/php/52/lib/php/extensions/no-debug-non-zts-20060613/"extension = mssql.so # 新增行
登录后复制

保存退出,重启php或者重启服务器。

推荐学习:《PHP视频教程

以上就是怎么增加php mssql扩展的详细内容,更多请关注php中文网其它相关文章!

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}