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

How to use php to access sql server under Linux

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Xiaobian to share with you how to use php to access sql server under Linux, I hope you have gained something after reading this article, let's discuss it together!

Install freeIDS

Official website download address: wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.00.18.tar.gz

1.1 Go to download directory extract tar xvf freetds-1.00.18.tar.gz

1.2, cd freetds-1.00.18 (the version I currently download is 1.00.18)

1.3, compiled: ./ configure –prefix=/export/servers/freetds-1.00.18 –with-tdsver=7.1 –enable-msdblib

Main parameter description: -with-tdsver Set the version of FreeTDS, I set 7.1 here in order to be able to connect to SQL2005

- enable-msdblib is whether Microsoft database libraries are allowed, here allowed;

1.4, make -j 4 (can also be directly made), -j 4 simultaneously compiled with 4 threads

1.5 make install

2. After installation, perform a test:

2.1、cd /export/servers/freetds-1.00.18/bin/

2.2、./ tsql -C

2.3 If the installation is successful, it displays:

2. mssql extension open

My php installation comes with mssql, mssql.so in the modules file

Just add extension=mssql.so to the last line of php.ini;

If you don't have MSSQL, you can install it independently:

Download the source package according to the current php version, assuming the current php-5.5.14

3.1 Unzip the source package for php-5.3.17.tar.gz.

3.2 The requested URL/export/software/php-5.5.14/ext/mssql/was not found on this server.

3.3, execute/export/servers/php-5.5.14/bin/phpize

3.4、./ configure –with-php-config=/export/servers/php-5.5.14/bin/php-config –with-mssql=/export/servers/freetds-1.0018/

3.5, make -j 4 (can also be directly made), -j 4 simultaneously compiled with 4 threads

3.6、make install

3.7 The requested URL/ls /export/servers/php-5.5.14/lib/php/extensions/was not found on this server.

[3.8、. Configuration php.ini extension_dir='/usr/local/php/lib/php/extensions/' optional]

3.9, add a line extension= mssql.so;

3.10 Restart the server

View main process ps-ef| grep php | grep master

After reading this article, I believe you have a certain understanding of "how to use php to access sql server under Linux". If you want to know more about this knowledge, please pay attention to the industry information channel. Thank you for reading!

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

Development

Wechat

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

12
Report