PHP安装sqlsrv和memcache扩展步骤
做了两天的实验才终于摸清楚如何将PHP连接上sqlserver数据库,以及怎样通过修改virtualhost文件来重定向,因为走得弯路比较多所以很想分享一下这次的心路历程。
第一步:安装wamp等类似的集成软件
我使用的是Wampserver2.4-x86这个集成软件包
(我碰到的Wampserver2.4里面的都是php5.4,Wampserver2.5里面的都是php5.5)
它里面包含了Apache/2.4.4 (Win32) PHP/5.4.16 MySql/5.5
安装好这个软件包之后可以在浏览器中输入127.0.0.1这个测试地址,如果出现如下界面

就说明这个软件正常安装。
第二步:安装相关组件以及下载相关扩展
本地机要安装相应 Microsoft SQL Server Native Client (软件叫sqlncli.msi),不然的话能安装上sqlsrv扩展但是连不上数据库
安装sqlsrv之前请认真看http://www.microsoft.com/en-us/download/details.aspx?id=20098
第三步:修改wamp中相关的配置
1.\wamp\bin\apache\Apache2.4.4\bin\php.ini
添加相应扩展文件名,比如
extension=php_pdo_sqlsrv_54_ts.dll
extension=php_sqlsrv_54_ts.dll
extension=php_memcache.dll
此处说明一下,wamp中实际起作用的php.ini是wamp\bin\apache\Apache2.4.4\bin\php.ini中的那个php.ini而不是wamp\bin\php\php5.4.16中的php.ini
2.wamp\bin\php\php5.4.16\ext
添加对应的扩展源文件,比如
php_pdo_sqlsrv_54_ts.dll
php_sqlsrv_54_ts.dll
php_memcache.dll
3.wamp\bin\apache\Apache2.4.4\conf\httpd.conf
修改DocumentRoot和Directory为如下样子(此处我是把我的项目都放在e:/www目录里)
DocumentRoot "e:/www"
<Directory "e:/www">
开启加载模块
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
Include conf/extra/httpd-vhosts.conf
4.wamp\bin\apache\Apache2.4.4\conf\extra\httpd-vhosts.conf
修改为以下样子,
<VirtualHost 127.0.0.1:80>
DocumentRoot "e:/www/"
ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.2:80>
DocumentRoot "E:/www/webdev2/m/trunk/web"
ServerName mm.test.fang.com
RewriteEngine on
#海外rewrite规则
RewriteRule ^/world/dgnews.html$ /world/index.php?c=world&a=dgnews [L]
RewriteRule ^/world/zynews.html$ /world/index.php?c=world&a=zynews [L]
</VirtualHost>
说明:可以将wamp\www中的两个文件复制到e:/www目录里这样可以方便以后查看相应版本信息,但是复制后要修改这个里面的index.php文件,不多,两个地方
$wampConfFile = '../wampmanager.conf';
$aliasDir = '../alias/';
将这里的相对路径改成绝对路径
5. C:\Windows\System32\Drivers\etc
修改host文件为如下形式
127.0.0.1 localhost
127.0.0.2 mm.test.fang.com
127.0.0.3 map1.test.fang.com
127.0.0.4 nmap.test.fang.com
修改之后要重启Apache,然后在地址栏中输入127.0.0.1会出现如下界面

红色部分为新添加的扩展。
看到这里只能说明你的扩展是连接上了,能不能连上sqlserver数据库还的看你之前安得Microsoft SQL Server Native Client是不是和你的操作系统匹配,最后用程序能连上数据库才说明真正的安好了。
细节:
1. php版本和你所下载的扩展是不是一致的;
2. php分为安全线程版(ts)和非安全线程版(nts),有的扩展也分这个,所以你的试一下,看哪个扩展适合
php_pdo_sqlsrv_54_ts.dll
php_sqlsrv_54_ts.dll
也有
php_pdo_sqlsrv_54_nts.dll
php_sqlsrv_54_nts.dll
3.安装sqlsrv扩展之前一定得看
http://www.microsoft.com/en-us/download/details.aspx?id=20098
官方文档说明
4.SQL Server Driver for PHP2.0 版本(sqlserver20.exe)
支持数据库版本:sqlserver 2005 ,sqlserver 2008
支持php版本:php5.2 , php5.3
.SQL Server Driver for PHP3.0 版本(sqlserver30.exe)
支持数据库版本:sqlserver 2005 ,sqlserver 2008, sqlserver 2012
支持php版本:php5.3 , php5.4
SQL Server Driver for PHP3.1 版本(sqlserver31.exe)
支持php版本:php5.5
总结:
微软的东西真TM嫌人
PHP安装sqlsrv和memcache扩展步骤的更多相关文章
- centos'的yum安装php的memcache扩展
centos'的yum安装php的memcache扩展 博客分类: linux 让php能使用memcached服务的扩展有两种:memcache 和 memcached 1. 先安装libmem ...
- linux centos 安装php的memcache扩展
一.centos6.5 yum安装php的memcache扩展 搜索memcache yum search memcache 有了,现在可以安装了 yum -y install memcached m ...
- 安装PHP及Memcache扩展
安装PHP及Memcache扩展 地址:http://blog.csdn.net/poechant/article/details/6802312 1. 下载 (1)libevent 官方网页:h ...
- linux下给php安装memcached及memcache扩展(转)
http://kimi.it/257.html (另外的方法)linux安装memcached及memcache扩展一.安装libevent函数库下载地址:http://libevent.org默认被 ...
- 安装php的memcache扩展
linux: 安装环境 RHEL 4 Php 5.2.6 所需软件 libevent-1.4.6-stable.tar.gz (http://monkey.org/~provos/libevent/) ...
- window下安装php7的memcache扩展
安装memcache:http://www.runoob.com/memcached/memcached-connection.html1.4.4 c:\memcached\memcached.exe ...
- linux安装memcached及memcache扩展
一.安装libevent函数库 下载地址:http://libevent.org 默认被安装到:/usr/local/lib目录下 安装memcached之前需要先安装libevent函数库. 可以通 ...
- linux-memcache安装及memcached memcache扩展
linux memcached安装yum -y install libevent libevent-deve yum list memcached yum -y install memcached m ...
- mac 下安装php7.1 memcache扩展
1.下载memcache源代码文件 https://github.com/websupport-sk/pecl-memcache/archive/php7.zip 文件夹名为:pecl-memcach ...
随机推荐
- Oracle to_char()和to_date()函数的用法
to_char()函数是我们经常使用的函数,下面就为您详细介绍Oracle to_date()函数的用法 1.to_char()函数分析 1)SQL中不区分大小写,MM和mm被认为是相同的格式代码 先 ...
- o(1)取b > a,且b的二进制中1的个数等于a二进制中1的个数,且使b最小
给你一个uint32 a,让你找到另一个uint32 b,使b > a,且b的二进制中1的个数等于a二进制中1的个数.且使b最小.(数据保证可出) 1 因为1的个数不变,所以必然大于n+lowb ...
- [译].Net 4.5 的五项强大新特性
本文原文:Five Great .NET Framework 4.5 Features 译者:冰河魔法师 目录 介绍 特性一:async和await 特性二:Zip压缩 特性三:正则表达式执行超时 特 ...
- hdu3874
题解: 和上一题基本相同 插入的时候变一下数值 具体看http://www.cnblogs.com/xuanyiming/p/7921926.html 代码: #include<cstdio&g ...
- bzoj1002
题解: f[i]=(f[i-1]*3+f[i-2]); 高精度计算 代码: #include<bits/stdc++.h> using namespace std; struct big ...
- 1011 A+B 和 C
给定区间 [-2^31, 2^31] 内的 3 个整数 A.B 和 C,请判断 A+B 是否大于 C. 输入格式: 输入第 1 行给出正整数 T (≤10),是测试用例的个数.随后给出 T 组测试用 ...
- L226
The dean can’t see you at the moment. He is addressing the first-year students in the lecture hall.系 ...
- Loom
<iframe width="630" height="394" src="https://www.useloom.com/embed/a9d4 ...
- poshytip漂亮的表单提示插件
一款很实用的小插件,在表单的输入框会显示提示信息,你可能会用的它. 实例代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transiti ...
- Linux C 中获取local日期和时间 time()&localtime()函数
1. time() 函数 /* time - 获取计算机系统当前的日历时间(Calender Time) * 处理日期时间的函数都是以本函数的返回值为基础进行运算 * * 函数原型: * #incl ...