Home  >  Article  >  Backend Development  >  The SQL Server database created on Navicat premium enables PHP connection, that is, php connection to Microsoft MSSQL.

The SQL Server database created on Navicat premium enables PHP connection, that is, php connection to Microsoft MSSQL.

WBOY
WBOYOriginal
2016-07-29 09:11:112660browse

Can be used in Sybase’s db-lib or ct-lib library, which also contains an ODBC library. Allows many application software to connect to Sybase or Microsoft SQL server;

Use FreeTDS under windows

  What is FreeTDS? FreeTDS is actually an open source (or can be said to be free) C library, which can be implemented in Linux Access and operate Microsoft's SQL database under the system. FreeTDS is released as source code, and because of this, it can be compiled and installed on almost any system.

If your server is a Windows system, then you should use php_dblib.dll. (more information on Using FreeTDS for Unix.)

1: Follow the link below to download php_dblib.dll and save it to the /PHP/ext folder.

https: //docs.moodle.org/30/en/Installing_MSSQL_for_PHP#Using_the_SQL_Server_2005_Driver_for_PHP_from_Microsoft_on_Windows

在Navicat premium上创建的<strong>SQL Server</strong>database, realize using PHP connection, that is, php to connect to Microsoft MSSQL

2. In php Add:

extension=php_dblib.dll to the configuration file /PHP/php.ini Restart apache

3: Test:

1    php
2        $link = mssql_connect('localhost', 'db_user', 'db_password');
3        if(!$link) {
4            echo'Could not connect';
5            die('Could not connect: ' . mssql_error());
6        }
7        echo'Successful connection';
8        mssql_close($link);
9    ?>

ok, success!!!

Reference: http://www.th7.cn /Program/php/201303/129462.shtml

The above introduces the SQL Server database created on Navicat premium, and realizes the use of PHP connection, that is, php to connect to Microsoft MSSQL, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

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