中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

iis中PHP安裝腳本PHPInstall.vbs V3.1的示例分析

發布時間:2021-10-13 14:35:00 來源:億速云 閱讀:338 作者:小新 欄目:開發技術

這篇文章給大家分享的是有關iis中PHP安裝腳本PHPInstall.vbs V3.1的示例分析的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

代碼如下:

'/*=========================================================================
' * 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

感謝各位的閱讀!關于“iis中PHP安裝腳本PHPInstall.vbs V3.1的示例分析”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

台江县| 万盛区| 菏泽市| 临沭县| 文水县| 台湾省| 临朐县| 右玉县| 竹山县| 营山县| 青海省| 万全县| 桐城市| 泌阳县| 吉首市| 郓城县| 德兴市| 丹阳市| 嘉善县| 陈巴尔虎旗| 刚察县| 安龙县| 沈丘县| 云霄县| 松原市| 克拉玛依市| 尼木县| 焦作市| 麻栗坡县| 平度市| 睢宁县| 措勤县| 登封市| 长海县| 宜州市| 宽甸| 临汾市| 犍为县| 司法| 上杭县| 卢氏县|