iis PHP安装脚本 PHPInstall.vbs V3.1
程序员文章站
2022-03-21 11:05:07
复制代码 代码如下:'/*=========================================================================...
复制代码 代码如下:
'/*=========================================================================
' * intro php安装脚本,您所要做的操作是:保存这个文件与要安装的php文件夹放一起(不要放在c盘根目录下)
' * (当前版本php-5.2.5-win32如果是其它请替换当前文档相关文件名),然后双击运行这个文件,<?phpinfo()?>
' * filename phpinstall.vbs
' * author yongfa365
' * version v3.1
' * madetime 2008-04-01 15:55:41
' * lastmodify 2009-05-04 12:21:48
' *==========================================================================*/
wscript.echo "开始配置php"
phpinstall "php-5.2.5-win32", "d:\php525", "c:"
'phpinstall "php所在目录","php要安装到哪","系统盘(如:c:)"
function phpinstall(phpfilepath, installpath, systempath)
on error resume next
set fso = createobject("scripting.filesystemobject")
'wscript.echo "删除c:\php"
fso.deletefolder installpath
fso.copyfolder phpfilepath, installpath '第一个参数为您要安装的php文件夹名,他的下一级是一堆文件及文件夹,而不是只有一个文件夹
'wscript.echo "删除c:\windows\system32\php5ts.dll及c:\windows\system32\libmysql.dll,然后复制新的"
fso.deletefile systempath & "\windows\system32\php5ts.dll"
fso.copyfile installpath & "\php5ts.dll", systempath & "\windows\system32\php5ts.dll"
fso.deletefile systempath & "\windows\system32\libmysql.dll"
fso.copyfile installpath & "\libmysql.dll", systempath & "\windows\system32\libmysql.dll"
'mcrypt加密处理
fso.deletefile systempath & "\windows\system32\libmcrypt.dll"
fso.copyfile installpath & "\libmcrypt.dll", systempath & "\windows\system32\libmcrypt.dll"
'wscript.echo "读取c:\php\php.ini-dist内容到变量phpstr"
phpstr = fso.opentextfile(installpath & "\php.ini-dist", 1, true).readall
'wscript.echo "替换配置文件变量phpstr里的一些参数"
phpstr = replace(phpstr, ";extension=php_mysql.dll", "extension=php_mysql.dll")
phpstr = replace(phpstr, ";extension=php_gd2.dll", "extension=php_gd2.dll")
phpstr = replace(phpstr, ";extension=php_mbstring.dll", "extension=php_mbstring.dll")
'phpstr = replace(phpstr, ";extension=php_mssql.dll", "extension=php_mssql.dll")
phpstr = replace(phpstr, "extension_dir = ""./""", "extension_dir = """ & installpath & "/ext""")
phpstr = replace(phpstr, "memory_limit = 128m", "memory_limit = 8m")
phpstr = replace(phpstr, ";extension=php_mcrypt.dll", "extension=php_mcrypt.dll")
phpstr = replace(phpstr, ";session.save_path = ""/tmp""", "session.save_path = """ & systempath & "\windows\temp""")
phpstr = replace(phpstr, "register_globals = off", "register_globals = on")
phpstr = replace(phpstr, "allow_url_include = off", "allow_url_include = on")
'安全
phpstr = replace(phpstr, "safe_mode = off", "safe_mode = on")
phpstr = replace(phpstr, "disable_functions =", "disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server")
'exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show_source,ini_alter
'system,exec,passthru,shell_exec,popen
'wscript.echo "将修改后的配置文件变量phpstr另存为:c:\windows\php.ini"
fso.createtextfile(systempath & "\windows\php.ini", true).writeline phpstr
set iiswebserviceobj = getobject("iis://localhost/w3svc")
'wscript.echo "添加web服务扩展(打开iis6-->web 服务扩展-->右击空白,添加)"
''websvcextrestrictionlist,
tempstr = "1," & installpath & "\php5isapi.dll,1,php,php扩展"
for each str in iiswebserviceobj.websvcextrestrictionlist
if(instr(str, "php") = 0) then
tempstr = tempstr & "柳永法" & str
end if
next
iiswebserviceobj.websvcextrestrictionlist = split(tempstr, "柳永法")
iiswebserviceobj.setinfo
'wscript.echo "添加应用程序扩展名映射(网站属性-->主目录-->配置-->映射-->添加)"
''scriptmaps
tempstr = ".php," & installpath & "\php5isapi.dll,5,get,head,post,debug"
for each str in iiswebserviceobj.scriptmaps
if(instr(str, "php") = 0) then
tempstr = tempstr & "柳永法" & str
end if
next
iiswebserviceobj.scriptmaps = split(tempstr, "柳永法")
iiswebserviceobj.setinfo
'默认首页
'iiswebserviceobj.defaultdoc = "index.htm,index.html,index.asp,default.aspx,index.php,default.htm,default.asp"
'iiswebserviceobj.setinfo
if instr(lcase(iiswebserviceobj.defaultdoc), "index.php") = 0 then
iiswebserviceobj.defaultdoc = iiswebserviceobj.defaultdoc & ",index.php"
iiswebserviceobj.setinfo
end if
wscript.echo "ok,php环境安装完成,为了对本程序作者:柳永法,表示感谢,请 大笑三声^_^"
end function
上一篇: 颜色填充
下一篇: 修改 Gateway和DNS的vbs脚本
推荐阅读
-
快速安装php7 的shell脚本
-
PHP4.23在WindowsXP下的IIS和Apache2两种服务器上的安装实例
-
PHP安装攻略:PHP3 + NT+IIS_PHP
-
在windows iis5下安装php4.0+mysql之我见_php基础
-
如若站点没安装APACHE服务,只装了IIS,会导致php文件被下载吗
-
PHP在XP下IIS和Apache2服务器上的安装_PHP教程
-
IIS环境下快速安装、配置和调试PHP5.2.0_php基础
-
PHP在XP下IIS和Apache2服务器上的安装_php基础
-
在Windows系统上安装PHP运行环境文字教程_php基础_脚本之家
-
PHP学习笔记 IIS7下安装配置php环境_php技巧