iis PHP安裝腳本 PHPInstall.vbs V3.1
'/*=========================================================================
' * Intro PHP安裝腳本,您所要做的操作是:保存這個(gè)文件與要安裝的php文件夾放一起(不要放在C盤(pán)根目錄下)
' * (當(dāng)前版本php-5.2.5-Win32如果是其它請(qǐng)?zhí)鎿Q當(dāng)前文檔相關(guān)文件名),然后雙擊運(yùn)行這個(gè)文件,<?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 "開(kāi)始配置PHP"
phpinstall "php-5.2.5-Win32", "D:\PHP525", "C:"
'phpinstall "php所在目錄","php要安裝到哪","系統(tǒng)盤(pán)(如: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 '第一個(gè)參數(shù)為您要安裝的php文件夾名,他的下一級(jí)是一堆文件及文件夾,而不是只有一個(gè)文件夾
'WScript.Echo "刪除C:\Windows\system32\php5ts.dll及C:\Windows\system32\libmysql.dll,然后復(fù)制新的"
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內(nèi)容到變量PHPStr"
PHPStr = FSO.OpenTextFile(InstallPath & "\php.ini-dist", 1, True).ReadAll
'WScript.Echo "替換配置文件變量PHPStr里的一些參數(shù)"
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服務(wù)擴(kuò)展(打開(kāi)IIS6-->web 服務(wù)擴(kuò)展-->右擊空白,添加)"
''WebSvcExtRestrictionList,
TempStr = "1," & InstallPath & "\php5isapi.dll,1,php,php擴(kuò)展"
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 "添加應(yīng)用程序擴(kuò)展名映射(網(wǎng)站屬性-->主目錄-->配置-->映射-->添加)"
''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
'默認(rèn)首頁(yè)
'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環(huán)境安裝完成,為了對(duì)本程序作者:柳永法,表示感謝,請(qǐng) 大笑三聲^_^"
End Function
上一篇:HTA文件去除html控件認(rèn)證和接收命令行參數(shù)
欄 目:vb
下一篇:添加網(wǎng)站到安全站點(diǎn).設(shè)置安全站點(diǎn)打開(kāi)ActiveX時(shí)提示.去頁(yè)眉頁(yè)腳的vbs代碼
本文標(biāo)題:iis PHP安裝腳本 PHPInstall.vbs V3.1
本文地址:http://mengdiqiu.com.cn/a1/vb/7555.html
您可能感興趣的文章
- 01-10用vbs控制iis創(chuàng)建虛擬目錄的代碼
- 01-10vbscript自動(dòng)配置IIS的代碼
- 01-10用VBS修改IIS Metabase 的代碼
- 01-10可以從一臺(tái)遠(yuǎn)程服務(wù)器運(yùn)行 SP2 安裝程序Install.vbs
- 01-10用vbs實(shí)現(xiàn)確定是否安裝了某個(gè)特定的補(bǔ)丁
- 01-10IIS管理腳本之a(chǎn)dsutil.vbs的使用說(shuō)明
- 01-10用VBS修改IIS Metabase的代碼
- 01-10定時(shí)自動(dòng)備份IIS的WWW日志的vbs腳本
- 01-10關(guān)于phpwind克隆用戶的方法
- 01-10用vbs清空iis log 中自己登錄ip的記錄


閱讀排行
- 1C語(yǔ)言 while語(yǔ)句的用法詳解
- 2java 實(shí)現(xiàn)簡(jiǎn)單圣誕樹(shù)的示例代碼(圣誕
- 3利用C語(yǔ)言實(shí)現(xiàn)“百馬百擔(dān)”問(wèn)題方法
- 4C語(yǔ)言中計(jì)算正弦的相關(guān)函數(shù)總結(jié)
- 5c語(yǔ)言計(jì)算三角形面積代碼
- 6什么是 WSH(腳本宿主)的詳細(xì)解釋
- 7C++ 中隨機(jī)函數(shù)random函數(shù)的使用方法
- 8正則表達(dá)式匹配各種特殊字符
- 9C語(yǔ)言十進(jìn)制轉(zhuǎn)二進(jìn)制代碼實(shí)例
- 10C語(yǔ)言查找數(shù)組里數(shù)字重復(fù)次數(shù)的方法
本欄相關(guān)
- 01-10下載文件到本地運(yùn)行的vbs
- 01-10飄葉千夫指源代碼,又稱qq刷屏器
- 01-10SendKeys參考文檔
- 01-10什么是一個(gè)高效的軟件
- 01-10VBS中的正則表達(dá)式的用法大全 &l
- 01-10exe2swf 工具(Adodb.Stream版)
- 01-10VBS中SendKeys的基本應(yīng)用
- 01-10用VBSCRIPT控制ONSUBMIT事件
- 01-10VBScript教程 第十一課深入VBScript
- 01-10VBScript語(yǔ)法速查及實(shí)例說(shuō)明
隨機(jī)閱讀
- 04-02jquery與jsp,用jquery
- 01-10delphi制作wav文件的方法
- 01-10SublimeText編譯C開(kāi)發(fā)環(huán)境設(shè)置
- 08-05DEDE織夢(mèng)data目錄下的sessions文件夾有什
- 08-05dedecms(織夢(mèng))副欄目數(shù)量限制代碼修改
- 01-11ajax實(shí)現(xiàn)頁(yè)面的局部加載
- 08-05織夢(mèng)dedecms什么時(shí)候用欄目交叉功能?
- 01-10使用C語(yǔ)言求解撲克牌的順子及n個(gè)骰子
- 01-10C#中split用法實(shí)例總結(jié)
- 01-11Mac OSX 打開(kāi)原生自帶讀寫(xiě)NTFS功能(圖文