PHP配置SQL Server 2008
1、到微软官方去下载新的驱动,下载地址如下:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9
官方文档有描述:
Refer to the documentation that is installed with the driver for a description of the new features in this release. The SQL Server Driver for PHP download is available to all SQL Server users at no additional charge. The SQL Server Driver for PHP is a PHP 5 extension that allows for the reading and writing of SQL Server data from within PHP scripts. The extension provides a procedural interface for accessing data in all editions of SQL Server 2005 and SQL Server 2008.
根据官方文档的描述,微软提供的Driver是同时提供给SQL Server 2005和SQL Server 2008两个版本使用的。
下载驱动(上边有链接地址)下载过后的驱动包里面的内容如下图:
2、需要修改C:\WINDOWS\php.ini中的配置:
查找;extension_dir 修改为extension_dir="E:\Program Files\php-5.3.1\ext"这里的目录是安装的PHP目录,ext里是PHP的一些扩展文件,运行时需要加载其中的一些,现在连接sqlserver,所以一定要去掉extension_dir 前面的分号;
3、把上图解压开的需要的dll文件拷贝到extension_dir设置的扩展目录里面。
其中‘53’表示php的版本,‘ts’表示启动线程安全,‘nts’表示未启动线程安全,vc6为apache配置,vc9为iis配置
4、修改php.ini实现扩展:
在php.ini的一大堆;extension=**.dll格式里面添加行,此部分位于以下注释下边一般:
; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.
添加拷贝的dll文件,例:
extension=php_sqlsrv_53_ts_v9.dll
注意=号右边是解开过后的扩展的两个驱动的文件名,必须保证此文件在配置好的扩展目录内,而
相关文档:
解析xml文档的类库有很多种,比较常用的就是SimpleXML,DOM Document,XMLReader,基于SAX的xml_parse函数。
根据xml文档结构,以及需求的不同,要选择好对应的类库。
解析小的文档的话,使用SimpleXML比较合适,简单的几个函数就可以搞定。
如果文档非常巨大,最好是XMLReader打开,中间转换成DOM来解析,感觉DOM与XPat ......
1、防止跳出web目录 (严重采用)
首先修改httpd.conf,如果你只允许你的php脚本程序在web目录里操作,还可以修改httpd.conf文件限制php的操作路径。比如你的web目录是/usr/local/apache/htdocs,那么在httpd.conf里加上这么几行:
php_admin_value open_basedir /usr/local/apache/htdocs
这样,如果脚本要 ......
<?PHP
//====================================================
// FileName: snap.class.php
//   ......
<?php
$start=$_GET['s'];
$end=$_GET['e'];
$requests = array();
for ($index = $start; $index < $end; $index++) {
$url="http://www.essort.com/amfphp/services/curl/loadTest.php?uid=$index";
$requests[]=$url;
}
$main = curl_multi_init();
$results = array();
$errors = array(); ......