tagged “PHP 5.3”
自从用上了PHP5.3,问题还真是多,自上次出现连接MS SQL Server的问题后,这次在安装 Zend Debugger时又出现了问题。按照Zend官方给出的Zend Debugger安装步骤,从 这里 下载了最新的 5.2版本的Studio Web Debugger,从解压出的ZendDebugger-v5.2-cygwin_nt-i386\5_3_x_nts_comp目录中复制ZendDebugger.dll 到PHP安装文件夹下的ext目录,然后编辑php.ini文件,在文件最后加入一下三行:
zend_extension = "d:/php/ext/ZendDebugger.dll"
zend_debugger.allow_hosts= 127.0.0.1
zend_debugger.expose_remotely=always
然后把dummy.php文件复制到apached的 "DocumentRoot"目录(在http.conf文件中设定),可重启Apache服务后 用phpinfo()显示的页面中并没有Zend Debugger,很明显,安装没有成功。
回过头再仔细看Zend的安装步骤介绍,发现zend_extension这项配置有两种,除了zend_extension以外,还有设置为zend_extension_ts的,分别适用于Non-Thread-Safe和Thread-Safe版的PHP,而我安装的PHP是Thread-Safe版的(通过phpinfo() 页面的Thread Safety选项可以查看到),所以应该用zend_extension_ts,但是我下载的Studio Web Debugger 针对php 5.3版的只有nts版的ZendDebugger.dll (从文件夹名称可以看出-5_3_x_nts_comp).
仔细搜了一下,终于找到了答案,在Zend 论坛里一位Zend 员工明确地回复:"目前还没有针对 Thread-Safe 的PHP 5.3发布相应的Zend Debugger的计划",这个帖子 里,另一位Zend员工针对用户在Thread Safe 版PHP 5.3 安装 Zend Debugger失败的原因做了更详细的解释:
Zend stopped supporting the thread safe architecture when Microsoft also decided to implement its PHP engine with the fast-cgi architecture which means non-thread-safe.
他建议用户用安装Zend Server(目前已经支持PHP 5.3)-- Zend Server包含的是Non Thread Safe 版的PHP.
相关链接:
Zend论坛 - 安装Zend Debugger 的非常详细的教程: Zend Forums • View topic - Sticky Notes Setting Up Zend Debugger
针对不同平台的最新Zend Debugger 下载列表
最近做的一个项目需要用PHP连接到MS SQL Server,在公司安装的PHP是5.2版的,Windows平台的PHP Zip安装包解压后的扩展目录(ext)里有自带连接到SQL Server的驱动文件-php_mssql.dll,只需先将PHP目录的ntwdblib.dll拷贝到系统盘下windows/system32,然后修改php.ini,取消;extension=php_mssql.dll 前面的;,重启Apache服务器就可以了。
但是家里用的是WAMP集成安装包,PHP版本是5.3.2,扩展目录里没有php_mssql.dll,而且连ntwdblib.dll也没有,从PHP 5.2分别拷贝这两个文件到扩展目录和系统目录,重启Apache,提示mssql模块和php编译版本不匹配(如下图):
在网上搜索了一下PHP 5.3.X 连接SQL Server的办法,有人也遇到了这个问题 (PHP Unable to Connect to MSSQL),原来PHP 团队在PHP 5.3 中移除了SQL Server的驱动和库,而微软自己开发了针对PHP的SQL驱动(SQL Server Driver for PHP),但是1.0版的不支持 PHP 5.3,1.1版本才支持,但即使用这种办法,也不是官方推荐的原生的支持,如果要用直接支持的办法,可以用ODBC来连接。这位作者对PHP 5.3连接 SQL Server的问题颇有研究,发了一系列的文章来说明问题的来龙去脉(No SQL Server Library for PHP 5.3 Just Yet,Installing PHP 5.3 on Microsoft IIS,Finally a working SQL Server Driver for PHP 5.3,Installing FastCGI and PHP for IIS 6.0)。 Finally a working SQL Server Driver for PHP 5.3 这篇文章的留言中有人给出了 他自己编译的PHP 5.3.0 连接 MS SQL Server所需的 php_mssql.dll 文件,但是这个文件之能用于VC9 PHP(何为VC9 PHP,请看补充内容)。
在SQL Server in PHP 5.3 这篇帖子的回复里,有人提到PHP 5.3.1里面有 php_mssql.dll,于是到PHP 官方网站,却只提供PHP 5.2和最新的PHP 5.3.2下载,最后还是在WAMP网站提供的 PHP Addon中找到了PHP 5.3.1,拷贝mssql扩展文件到WAMP 的PHP扩展目录,问题解决!
补充:关于VC9 和VC6 版本的PHP
If you are using PHP with Apache 1 or Apache2 from apache.org you need to use the VC6 versions of PHP
If you are using PHP with IIS you should use the VC9 versions of PHP
VC6 Versions are compiled with the legacy Visual Studio 6 compiler
VC9 Versions are compiled with the Visual Studio 2008 compiler and have improvements in performance and stability. The VC9 versions require you to have the Microsoft 2008 C++ Runtime (x86) or the Microsoft 2008 C++ Runtime (x64) installed
Do NOT use VC9 version with apache.org binaries
相关链接:
PHP: Installation of extensions on Windows - Manual



