Related methods of connecting Sql database with PHP_PHP tutorial

WBOY
Release: 2016-07-15 13:31:08
Original
831 people have browsed it

We are using Recently, someone asked me if I want to use php to connect to the sql server database when developing using PHP. I told them that they can use the mssql_connect($host,$username,$password) method to connect PHP to the Sql database.

Actually, you can find this function by searching online, and many people use it. However, a friend reported that mssql_connect() is not defined in the system, which is strange. I have always used it this way. I suspected that his PHP version was too low to support it. He told me that it was php5.14. There is no problem with this version.

What’s the problem? I tried various methods later but couldn't solve it.

Later, suddenly, I remembered that PHP functions are all configured by PHP.INI. Could it be that the support for sql server was not enabled? At first glance, it turns out there is none.

Solution to PHP connecting to Sql database:

1. Find php.ini in the apache2 directory and open it.

2. Find ";extension=php_mssql.dll", remove the ";" in front of it, save

3. Restart the apache service (note that it must be restarted, many people often forget it without knowing it Reason)

Use mssql_connect() to connect to the sql server to completely connect PHP to the Sql database.


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446245.htmlTechArticleWe are using it. Recently, someone asked me if I want to use php to connect to the sql server database when developing using PHP. I told them that they can use mssql_connect($host,$username,$password) method to achieve...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template