Vista下Apache2.26+PHP5.2.5的配置问题

来源:互联网 发布:英语私教 知乎 编辑:程序博客网 时间:2024/05/15 05:19

Vista下Apache2.26+PHP5.2.5的配置问题

关于Vista下Apache 2.26+PHP5.2.5+MySQL5.0的配置问题(错误代码:2738)

问题描述:
  在Vista下按默认选项安装Apache 2.26+PHP5.2.5+MySQL5.0后,会发现无法使用PHP连接MySQL数据库,如果经过修改PHP下的Php.ini和Apache下的httpd.conf(具体方法见网上相关指导不细说)后还是无法连接成功.此时还可通过重装PHP来解决PHP对MySQL数据库的支持.但在安装(无论是修改安装还是删除)时发生如下错误:
"The installer has encountered an unexpected error installing this
package. This may indicate a problem with this package. The error code is
2738."

问题探究:
该错误在XP中未发生,怀疑和Vista的UAC功能有关,查看安装日志文件:
Reproduce code:
---------------
Please find an excerpt from verbose logging mode output below
(non-elevated console).

msiexec /i php-5.2.5-win32-installer.msi /l*v error.log

完整的日志可以到这儿查看:

http://alvaro.es/archivos/error_2.5.2_2007-12-11.log.zip [30KB]
http://alvaro.es/archivos/error_2.5.6-dev_2008-01-04.log.zip [30KB]

内容:
Actual result:
--------------
[...]
MSI (s) (CC:6C) [07:51:45:428]: Running as a service.//服务启动成功
MSI (s) (CC:6C) [07:51:45:432]: Hello, I'm your 32bit Impersonated custom
action server.
MSI (s) (CC:E4) [07:51:45:434]: Note: 1: 2205 2:  3: Error
MSI (s) (CC:E4) [07:51:45:434]: Note: 1: 2228 2:  3: Error 4: SELECT
`Message` FROM `Error` WHERE `Error` = 2738
DEBUG: Error 2738:  Could not access VBScript runtime for custom action
The installer has encountered an unexpected error installing this package.
This may indicate a problem with this package. The error code is 2738. The
arguments are: , ,
//调试错误2378:服务行为不能访问VBScript运行时.安装服务在该程序包中遇到问题,代码:2738,这些参数是:
MSI (s) (CC:E4) [07:51:46:615]: Note: 1: 2205 2:  3: Error
MSI (s) (CC:E4) [07:51:46:615]: Note: 1: 2228 2:  3: Error 4: SELECT
`Message` FROM `Error` WHERE `Error` = 1709
MSI (s) (CC:E4) [07:51:46:615]: Product: PHP 5.2.3 -- The installer has
encountered an unexpected error installing this package. This may indicate
a problem with this package. The error code is 2738. The arguments are: , ,

问题解决方案:
从上面的日志中可以看出是由于无法访问VBScript动态链接库产生的错误,由于Vista默认不会自动加载该库,
请按照以下步骤进行:
1.点击任务栏开始(StartMenu)--所有程序--附件---命令提示符"cmd";
2.点右键,选择"以管理员身份运行",如图所示:


3.输入:regsvr32 vbscript.dll ,回车(Enter),会弹出提示信息调用成功.

再次运行安装程序,此时就不会有该错误出现了.
要提醒您一下,要使用安装程序打开MySQL支持,请在安装时选择"Custom(定制)"并在Extension里找到MySQL,选择"Install on this disk(安装该项目)",选择Apache配置目录时一定要选择安装目录/conf.

PHP连接MySQL测试代码:
<html>
<body>
<?php
$db = mysql_connect("localhost", "root","root");//此处用户名为root,密码:root,根据实际情况修改
if(!$db) echo "失败!<br>";
else echo "成功!<br>";
mysql_close();
?>
</body>
</html>

本方案不讲解这两个软件的安装,按默认安装即可.一般都没有问题可以直接运行的. 

原创粉丝点击