search
HomeBackend DevelopmentPHP ProblemHow to add php mssql extension
How to add php mssql extensionJan 28, 2022 am 10:28 AM
mssqlphp

Methods to add php mssql extension: 1. Download freetds and php source code package; 2. Install freetds; 3. Unzip the php source code package and enter the mssql extension directory; 4. Generate configure; 5. Edit php. ini file, just add the mssql extension.

How to add php mssql extension

The operating environment of this article: linux5.9.8 system, php-5.2.17 version, DELL G3 computer

How to add php mssql Extension?

php install mssql extension

About the with-tdsver parameter when compiling freetds

After FreeTDS version 1.1, it can be set to auto. The version needs to be specified manually before.

I have written about mssql module installation before. This time I just added the with-tdsver parameter when compiling freetds.

1. Download freetds and php source code package

[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. Install freetds

# Unzip the freetds source code package

[root@VM_0_11_centos ~]# tar zxvf freetds-1.1.21.tar.gz
[root@VM_0_11_centos ~]# cd freetds-1.1.21/

# Start compilation and installation

[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. Compile the mssql module

# Unzip the php source code package

[root@VM_0_11_centos ~]# tar zxvf php-5.2.17.tar.gz

# Enter the mssql extension directory

[root@VM_0_11_centos ~]# cd php-5.2.17/ext/mssql/

# Generate configure

[root@VM_0_11_centos mssql]# /www/server/php/52/bin/phpize

# Start compiling

[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. Edit the php.ini file and add the mssql extension under line 491 Add (if you don’t know how to use the vi editor, you can directly download and modify the file and then upload it)

[root@VM_0_11_centos ~]# vi /www/server/php/52/etc/php.ini
extension_dir = "/www/server/php/52/lib/php/extensions/no-debug-non-zts-20060613/"
extension = mssql.so # 新增行

Save and exit, restart php or restart the server.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to add php mssql extension. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
php怎么把负数转为正整数php怎么把负数转为正整数Apr 19, 2022 pm 08:59 PM

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

php怎么连接mssql数据库php怎么连接mssql数据库Oct 23, 2023 pm 12:02 PM

php连接mssql数据库的方法有使用PHP的MSSQL扩展、使用PDO等。详细介绍:1、使用PHP的MSSQL扩展方法,确保PHP安装了MSSQL扩展。可以在PHP配置文件(php.ini)中检查是否启用了mssql扩展;2、使用PDO方法,确保PHP安装了PDO扩展。可以在PHP配置文件(php.ini)中检查是否启用了pdo_sqlsrv扩展。

php怎么实现几秒后执行一个函数php怎么实现几秒后执行一个函数Apr 24, 2022 pm 01:12 PM

实现方法:1、使用“sleep(延迟秒数)”语句,可延迟执行函数若干秒;2、使用“time_nanosleep(延迟秒数,延迟纳秒数)”语句,可延迟执行函数若干秒和纳秒;3、使用“time_sleep_until(time()+7)”语句。

Ubuntu安装PHP并配置MSSQL连接的详细指南Ubuntu安装PHP并配置MSSQL连接的详细指南Feb 29, 2024 am 11:15 AM

Ubuntu是一款流行的开源操作系统,常用于服务器运行。在Ubuntu上安装PHP并配置MSSQL连接是许多开发者和系统管理员经常需要做的操作之一。本文将为读者提供一份详细的指南,步骤包含安装PHP、设置Apache、安装MSSQLServer等内容,并附上具体的代码示例。第一步:安装PHP及相关扩展首先,我们需要安装PHP及其相关扩展,以便支持PHP连接

php怎么除以100保留两位小数php怎么除以100保留两位小数Apr 22, 2022 pm 06:23 PM

php除以100保留两位小数的方法:1、利用“/”运算符进行除法运算,语法“数值 / 100”;2、使用“number_format(除法结果, 2)”或“sprintf("%.2f",除法结果)”语句进行四舍五入的处理值,并保留两位小数。

php怎么根据年月日判断是一年的第几天php怎么根据年月日判断是一年的第几天Apr 22, 2022 pm 05:02 PM

判断方法:1、使用“strtotime("年-月-日")”语句将给定的年月日转换为时间戳格式;2、用“date("z",时间戳)+1”语句计算指定时间戳是一年的第几天。date()返回的天数是从0开始计算的,因此真实天数需要在此基础上加1。

php怎么替换nbsp空格符php怎么替换nbsp空格符Apr 24, 2022 pm 02:55 PM

方法:1、用“str_replace(" ","其他字符",$str)”语句,可将nbsp符替换为其他字符;2、用“preg_replace("/(\s|\&nbsp\;||\xc2\xa0)/","其他字符",$str)”语句。

php怎么判断有没有小数点php怎么判断有没有小数点Apr 20, 2022 pm 08:12 PM

php判断有没有小数点的方法:1、使用“strpos(数字字符串,'.')”语法,如果返回小数点在字符串中第一次出现的位置,则有小数点;2、使用“strrpos(数字字符串,'.')”语句,如果返回小数点在字符串中最后一次出现的位置,则有。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment