手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表2024年11月的文章

phpsqlsrv for windows

http://www.microsoft.com/download/en/confirmation.aspx?id=20098
其实在很久前就有这玩意了,现在居然是3.0了。在win下用这个驱动好啊,支持最新的Sql server,而且速度很快。同时,它居然还支持了PDO。。。

下载下来很方便,有几种不同的文件,根据你当前的情况来设置:
Perform the following steps to download and install the Microsoft Drivers for PHP for SQL Server:
1. Download SQLSRV30.EXE to a temporary directory
2. Run SQLSRV30.EXE
3. When prompted, enter the path to the PHP extensions directory
4. After extracting the files, read the Installation section of the SQLSRV30_Readme.htm file for next steps
看着readme一步一步就Over了。
08年的时候根据第一版的文件写过一个很简单的连接库,替换掉了当时discuz的sql连接库。现在。。。还是用PDO吧

Tags: phpsqlsrv, windows, php

Persist Security InFso=true 是什么意思

Conn2.Open "Provider=SQLOLEDB.1;Persist Security InFso=true;Data Source=192.168.1.2;Initial Catalog=xxxxx;User ID=sa;Password=123456;"

一些参考信息:
Integrated   Security默认值是False,此时需要提供Uid和Pwd,即将以Sql   Server   用户身份登陆数据库;如果设置为True,Yes   或   SSPI,这不能出现Uid和Pwd,将以Windows用户省份登陆数据库。强烈推荐用后一种形式,安全性更高。

参见
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataSqlClientSqlConnectionClassConnectionStringTopic.asp
--------
http://expert.csdn.net/Expert/topic/2930/2930660.xml?temp=.423382

Persist   Security   Info   布尔类型,为True时,表明采用集成安全机制;若为False,则表明不采用集成安全机制。

更多资料还是看:http://connectionstrings.com/,还是这个网站好玩。

Tags: sqlserver

Microsoft SQL Server Functions (PDO_SQLSRV)

Introduction

PDO_SQLSRV is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MS SQL Server (starting with SQL Server 2005) and SQL Azure databases.

Installation

The PDO_SQLSRV extension is enabled by adding appropriate DLL file to your PHP extension directory and the corresponding entry to the php.ini file. The PDO_SQLSRV download comes with several driver files. Which driver file you use will depend on 3 factors: the PHP version you are using, whether you are using thread-safe or non-thread-safe PHP, and whether your PHP installation was compiled with the VC6 or VC9 compiler. For example, if you are running PHP 5.3, you are using non-thread-safe PHP, and your PHP installation was compiled with the VC9 compiler, you should use the php_pdo_sqlsrv_53_nts_vc9.dll file. (You should use a non-thread-safe version compiled with the VC9 compiler if you are using IIS as your web server). If you are running PHP 5.2, you are using thread-safe PHP, and your PHP installation was compiled with the VC6 compiler, you should use the php_pdo_sqlsrv_52_ts_vc6.dll file.

For more information about system requirements, see » SQLSRV System Requirements.

The PDO_SQLSRV extension is only compatible with PHP running on Windows. For Linux, see ODBC and » Microsoft's SQL Server ODBC Driver for Linux.

System Requirements (Microsoft Drivers for PHP for SQL Server)

 

SQL Server 2008 R2

To access data in a SQL Server 2005 or later database using the Microsoft Drivers for PHP for SQL Server, you must have the following components installed on your computer:

  • Supported operating systems for version 3.0 of the driver include:

    • Windows Server 2008 R2 SP1

      Windows Vista SP2

      Windows Server 2008 SP2

      Windows 7 SP1

  • Supported operating systems for version 2.0 of the driver include:

    • Supported operating systems for version 2.0 of the driver include:

    • Windows Server 2003 Service Pack 1

    • Windows XP Service Pack 3

    • Windows Vista Service Pack 1 or later

    • Windows Server 2008

    • Windows Server 2008 R2

    • Windows 7

  • PHP 5. For information about how to download and install the latest stable binaries, visit http://php.net.

    Microsoft Drivers for PHP for SQL Server, version 3.0 requires PHP 5.3.0 or later. If possible, use PHP 5.3.6, or later. The version 2.0 driver works with PHP 5.2.4 or later. If possible, use PHP 5.2.13, or later.

  • A version of the driver file must be in your PHP extension directory. See Driver Versions later in this topic for information about the different driver files. See Loading the Microsoft Drivers for PHP for SQL Server for information on configuring the driver for the PHP runtime.

    (See The Data Center for the Microsoft Drivers for PHP for SQL Server for information on where to download the Microsoft Drivers for PHP for SQL Server.)

  • A Web server. Your Web server must be configured to run PHP. For information about hosting PHP applications with Internet Information Services (IIS) 6.0, see Using FastCGI to Host PHP Applications on IIS 6.0. For information about hosting PHP applications with IIS 7.0, see Using FastCGI to Host PHP Applications on IIS 7.0.

    The Microsoft Drivers for PHP for SQL Server has been tested using IIS 6 and IIS 7 with FastCGI.

  • The x86 version of SQL Server Native Client is required on the computer where PHP is running. If you are using a 64-bit operating system, the x86 version of SQL Server Native Client will be installed with the x64 version of SQL Server Native Client (do not install the x86 version of SQL Server Native Client on an x64 operating system).

    If you are using the SQLSRV driver, sqlsrv_client_info will return information about which version of SQL Server Native Client is being used by the Microsoft Drivers for PHP for SQL Server. If you are using the PDO_SQLSRV driver, you can use PDO::getAttribute to discover the version.

This section lists the drivers that are installed for version 2.0 and version 3.0 of the Microsoft Drivers for PHP for SQL Server. PHP version 5.2 is not supported in version 3.0 of the Microsoft Drivers for PHP for SQL Server.

Follow the installation instructions in Loading the Driver to configure the driver for use with the PHP runtime.

Microsoft Drivers 2.0 for PHP for SQL Server installs several versions of the driver:

 

Driver file

PHP version

Thread safe?

Use with PHP .dll

php_sqlsrv_53_nts_vc6.dll

php_pdo_sqlsrv_53_nts_vc6.dll

5.3

no

php5.dll

php_sqlsrv_53_nts_vc9.dll

php_pdo_sqlsrv_53_nts_vc9.dll

5.3

no

php5.dll

php_sqlsrv_53_ts_vc6.dll

php_pdo_sqlsrv_53_ts_vc6.dll

5.3

yes

php5ts.dll

php_sqlsrv_53_ts_vc9.dll

php_pdo_sqlsrv_53_ts_vc9.dll

5.3

yes

php5ts.dll

php_sqlsrv_52_nts_vc6.dll

php_pdo_sqlsrv_52_nts_vc6.dll

5.2

no

php5.dll

php_sqlsrv_52_ts_vc6.dll

php_pdo_sqlsrv_52_ts_vc6.dll

5.2

yes

php5ts.dll

If the name of the driver file contains "vc9", it should be used with a PHP version compiled with Visual C++ 9.0.

Microsoft Drivers 3.0 for PHP for SQL Server installs several versions of the driver:

 

Driver file

PHP version

Thread safe?

Use with PHP .dll

php_sqlsrv_53_nts.dll

php_pdo_sqlsrv_53_nts.dll

5.3

no

php5.dll

php_sqlsrv_53_ts.dll

php_pdo_sqlsrv_53_ts.dll

5.3

yes

php5ts.dll

Tags: sqlserver, microsoft, pdo

Google Cloud Storage

由于看了几个VPS都是空间比较小,所以开始考虑是否用第三方存储来放置一些数据。
其实在国外有很多类似的工具,比如dropbox,sugarsync,但这些其实在命令行下用起来都不太方便或者说用PHP调用,所以还是考虑了一些S3或者googlestorage之类的存储。

google有一些现成的工具:https://developers.google.com/storage

Google Cloud Storage is a new service for developers to store and access data in Google's cloud. It offers developers direct access to Google's scalable storage and networking infrastructure as well as powerful authentication and data sharing mechanisms. Developers can store objects of any size and manage access to their data on an individual or group basis using Google Cloud Storage.

Google Cloud Storage is accessible through its REST API or using any of the available Google Cloud Storage tools, including:

  • Google Storage Manager - A graphical user interface with drag-and-drop features to manage your buckets and objects.
  • GSUtil - A command line tool that lets you perform basic and advanced tasks for Google Cloud Storage.

S3的话,会相对比较资料更多一点,毕竟还是老牌供应商,这里有一篇详细教程:http://www.xieyidian.com/2665,图文并茂,在这里还有文中所提到的计算器:在线计算器

现在还在犹豫,因为毕竟我对这些都不熟,英文也烂,不知道怎么搞比较好,纠结啊。

-------

所以,本文只是备份资料,下次用的时候可以直接找到它

Tags: google, storage, s3, amazon

phpQuery的一个小疑问。

最近在使用phpQuery处理xml的时候发生了一点小问题。由于xml还算是比较规范,但我又不想用simplexml_load_string,所以就偷懒用phpQuery处理了。
但在处理的时候发现一个问题,比如我要处理的内容是:

XML/HTML代码
  1. <title>揭秘日本巨型OLED地球仪:实时显示地球变化</title>  
  2. <link>http://news.dili360.com/gclw/xxjs/2012/0312/32136.shtml</link>  
  3. <description><a href='http://news.dili360.com/gclw/xxjs/2012/0312/32136.shtml'><img src='http://image.dili360.com/news/gclw/xxjs/2012/0312/36_5132136203_20120312094816.jpg' style='border: 1px solid #000000;'/></a>   新浪科技讯 北京时间3月12日消息,据国外媒体报道,如果你前往日本东京,别忘了去参观一下“未来科学馆”(Miraikan),这里展示着一些最尖端的技术成就。就在去年年中,这里揭幕了全世界首个大型OLED显示屏,直径超过19英尺(约合5.8米)。尽管名叫“Geo-Cosmos”,但这并非一般的地球仪,它几乎能实时显示我们这颗星球上正在发生的一切!全球各地的科学家和研究机构将数据发送给Geo-Cosmos,后者将其呈现给观众。   这..</description>  
  4. <category>中国国家地理网地理资讯频道</category>  
  5. <author>dili360.com</author>  
  6. <pubdate>2012-03-12 09:48:16</pubdate>  

请看加红的那一段。
当我用phpQuery处理完后,发现,右边的</link>不见了。其他元素都正常。我的心一下子就碎了。
开始以为页面有问题,但怎么处理都是这样,最终只能将link换成了url来 进行处理。说实话,心是哇凉哇凉的。。

但是,同事在win下面就没有这个问题,我在ubuntu下就有这个问题。(我现在不知道是否我的PHP版本有问题,还是平台的问题,也没有心思深究了)【同事是5.3.9,我是5.3.6】,

Tags: phpquery