Home  >  Article  >  Backend Development  >  How to add php mssql extension

How to add php mssql extension

藏色散人
藏色散人Original
2022-01-28 10:28:282747browse

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