Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the configuration of PHP 5.2.x to connect to SQL Server database FreeTDS under Linux

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces what is the configuration of PHP 5.2.x connection to SQL Server database FreeTDS under Linux, the content is very detailed, interested friends can refer to, hope to be helpful to you.

PHP (FastCGI) under CentOS 5.4Linux needs to connect to the SQL Server 2000 database of the relevant departments and is configured with extended FreeTDS extensions.

1. Compile and install FreeTDS

Mkdir-p / data0/software/

Cd / data0/software/

Wget ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz

Tar zxvf freetds-stable.tgz

Cd freetds-0.82/

. / configure-- prefix=/usr/local/webserver/freetds-- with-tdsver=8.0-- enable-msdblib

Make & & make install

Cd.. /

Echo "/ usr/local/webserver/freetds/lib/" > / etc/ld.so.conf.d/freetds.conf

Ln-s / usr/local/webserver/freetds/lib/libsybdb.so.5.0.0 / usr/local/webserver/freetds/lib/libsybdb.so.4

/ sbin/ldconfig

Rm-f / usr/local/webserver/freetds/etc/freetds.conf

Vi / usr/local/webserver/freetds/etc/freetds.conf

Enter the following:

Quote

[global]

# TDS protocol version

; tds version = 4.2

# Whether to write a TDSDUMP file for diagnostic purposes

# (setting this to / tmp is insecure on a multi-user system)

; dump file = / tmp/freetds.log

; debug flags = 0xffff

# Command and connection timeouts

; timeout = 10

; connect timeout = 10

# If you get out-of-memory errors, it may mean that your client

# is trying to allocate a huge buffer for a TEXT field.

# Try setting 'text size' to a more reasonable limit

Text size = 64512

Host = mssql.yourdomain.com

Port = 1433

Tds version = 8.0

Client charset = UTF-8

2. Compile and install PHP with MSSQL extension

Enter the local directory of the existing php-5.2.XX source package:

Cd / data0/software/ php-5.2.XX/ext/mssql/

/ usr/local/webserver/ php/bin/ phpize

. / configure-with- php-config=/usr/local/webserver/ php/bin/ php-config-with-mssql=/usr/local/webserver/freetds/

Make & & make install

3. Add mssql.so to the php.ini configuration file

Vi / usr/local/webserver/ php/etc/ php.ini

Add one line:

Quote

Extension = "mssql.so"

4. Restart PHP FastCGI

/ usr/local/webserver/ php/sbin/ php-fpm restart

5. Test file (test_mssql.php):

View plain copy to clipboard print?

On the Linux PHP 5.2.x connection to the SQL Server database FreeTDS configuration is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report