PHP connection to SQL database _ PHP Tutorial

Source: Internet
Author: User
PHP connection to the SQL database. Recently, I was asked if I wanted to use PHP to connect to the sqlserver database during php development. I told them that mssql_connect ($ host, $ username, $ password) can be used for implementation. Recently, someone asked me if I was using PHP for development, I want to use php to connect to the SQL server database. I told them that mssql_connect ($ host, $ username, $ password) can be used to connect PHP to the SQL database.

In fact, you can find this function once you search the internet. many of them use it. However, my friend reported that the system does not define mssql_connect (), which is strange. I have always used it. I suspect that his PHP version is too low to support it, he told me php5.14. This version does not have a problem.

Where is the problem? I tried a variety of methods later and couldn't solve it.

Later, I suddenly remembered that PHP's functions were all configured by PHP. INI. will it fail to enable SQL server support? At first glance, no.

PHP connection to SQL database solution:

1. find php. ini in the directory of apache2 and open it.

2. find "; extension = php_mssql.dll", remove the previous ";", and save

3. restart the apache service (be sure to restart it. many of them often forget it, but do not know why)

You can use mssql_connect () to connect to SQL server to connect PHP to SQL database.


Recently, someone asked me if I wanted to use PHP to connect to the SQL server database during php development. I told them that mssql_connect ($ host, $ username, $ password) can be used for implementation...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.