To install the SQL Server-driven step method in Wamp

Source: Internet
Author: User
Tags driver manager odbc sql server driver mssql access database

Installing SQL Server-driven methods in Wamp


Configure the Php+sql server connection mode to successfully configure the remote Access database.


PHP's own MSSQL extension php_mssql.dll is for SQL Server 2000

To use SQL Server 2005 or later, use the latest third-party extended SQL Server Driver for PHP provided by Microsoft for PHP.


The following are the steps to install: (Prerequisites, in the case of Wamp installation, the icon is pink, turn on and turn green is normal)

The first step, download SQL Server Driver for PHP,

(: http://www.microsoft.com/en-us/download/details.aspx?id=20098

Related information: http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx

After downloading, unzip all the. dll (copy the corresponding DLL file) file to the Ext folder of the PHP installation directory. The latest version of 3.2 is an application such as SQLSRV32.


Run SQLSRV32, enter the Ext folder of the PHP installation directory, for example E:\wamp\bin\php\php5.5.12\ext Click OK, then open php.ini, add the following statement to open Php_sqlsrv and Php_pdo_ SQLSRV Extensions:

——————————————————–

[Php_pdo_sqlsrv]

Extension=php_pdo_sqlsrv_55_ts.dll

[Php_sqlsrv]

Extension=php_sqlsrv_55_ts.dll


--========================================

Here 55 is php5.5, if you are 5.4 version, change to 54, if your PHP version is thread-safe, then your PHP installation directory should have a php5ts.dll, and here the two lines corresponding to the statement, if it is Php5nts.dll, then the above statement should be:

[Php_pdo_sqlsrv]

Extension=php_pdo_sqlsrv_54_nts.dll

[Php_sqlsrv]

Extension=php_sqlsrv_54_nts.dll


# #重启Apache, to see the PHP information can be seen sqlsrv configuration information, if there is no such information, it is likely that the version of the drive extension file is inconsistent with your PHP version.

--=========================================

The second step, the connection test creates a PHP test script similar to the following, access the script on the browser http:\localhost\test01.php

The following is the test code:

<?php

$db _server = ' 192.168.31.1 ';

$db _id = ' sa ';

$db _pwd = ' [email protected] #123 ';

$db _name = ' abc ';


$con _info = Array ("Database" = $db _name, "UID" = = $db _id, "PWD" =


$db _pwd);

Global $con;

$con = Sqlsrv_connect ($db _server, $con _info);

$con = Mssql_connect ($db _server, $db _id, $db _pwd);

if (! $con) {

Print_r (sqlsrv_errors ());

}else{

echo "connected!";

}

?>

--================================

If an error occurs, proceed to the third step, if prompted "connected! ", then the configuration is successful.

If there is an error in the access, it will generally return information similar to the following, according to which the URL to download native Client to install, that is, the third step mentioned here.


--=========================================== like this, for example.

Array

(

[0] = = Array

(

[0] = IMSSP

[SQLSTATE] = IMSSP

[1] =-49

[Code] =-49

[2] = = This extension requires the Microsoft SQL Server 2012


Native Client. Access the following URL to download the Microsoft SQL


Server Native Client ODBC driver for x86:


http://go.microsoft.com/fwlink/?LinkId=163712

[message] = = This extension requires the Microsoft SQL Server


Native Client. Access the following URL to download the Microsoft


SQL Server Native Client ODBC driver for x86:


http://go.microsoft.com/fwlink/?LinkId=163712

)


[1] = = Array

(

[0] = IM002

[SQLSTATE] = IM002

[1] = 0

[Code] = 0

[2] = = [MICROSOFT][ODBC Driver Manager] Data source name not found and unspecified


Default Driver

[message] \ = [MICROSOFT][ODBC Driver Manager] No data source name found and


And does not specify a default driver

)

)


--======================================================

Step three, download the Microsoft SQL Server Native client to install.

: http://www.softpedia.com/dyn-postdownload.php?p=144149&t=0&i=2

After downloading, run the application sqlncli, all the way next after the installation is complete!




Fourth step, find mssql.secure_connection = off under PHP.ini, modify off to On, as follows:


Mssql.secure_connection = On


To install the SQL Server-driven step method in Wamp

Related Article

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.