Code Monkey home page Code Monkey logo

guides's People

guides's Issues

安装SQL Server 2008 R2需要注意的事项

1.安装步骤

详细见:https://www.jianshu.com/p/62916df2c487

2.Microsoft Drivers for PHP for Microsoft SQL Server

下载: https://github.com/Microsoft/msphpsql

  • 添加如下扩展:php_pdo_odbc,php_pdo_sqlsrv,php_sqlsrv
  • 将驱动拷贝至php/ext目录下,在php.ini中添加如下四行
    extension=php_pdo_sqlsrv_7_nts.dll
    extension=php_pdo_sqlsrv_7_nts_x64.dll
    extension=php_sqlsrv_7_nts.dll
    extension=php_sqlsrv_7_nts_x64.dll
    保存,重启。查看phpinfo页面是否含有sqlsrv.

3.测试是否能连接

<?php
	//连接SQL Server测试

	$dbms='sqlsrv';     //数据库类型
	$server='127.0.0.1'; //数据库主机名
	$database='test';    //使用的数据库
	$user='sa';      //数据库连接用户名
	$pass='root';          //对应的密码
	$dsn="$dbms:server=$server;database=$database";

	try {
		$dbh = new PDO($dsn, $user, $pass); //初始化一个PDO对象
		echo "连接成功!";
	} catch (PDOException $e) {
		die ("Error!: " . $e->getMessage() . "<br/>");
	}
?>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.