Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of PHP installation script PHPInstall.vbs V3.1 in iis

Shulou Source: shulou.com Published: 2022-06-03 06:05:20 09月12日 Update

This article shares with you the content of the sample analysis of the PHP installation script PHPInstall.vbs V3.1 in iis. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The code is as follows:

'/ * =

'* Intro PHP installation script, all you have to do is to save this file with the php folder you want to install (do not put it in the root directory of C disk)

'* (if the current version of php-5.2.5-Win32 is something else, please replace the relevant file name of the current document), and then double-click to run the file

'* FileName PHPInstall.vbs

'* Author yongfa365

'* Version v3.1

'* MadeTime 2008-04-01 15:55:41

'* LastModify 2009-05-04 12:21:48

'* /

Wscript.Echo "start configuring PHP"

Phpinstall "php-5.2.5-Win32", "D:\ PHP525", "C:"

Phpinstall "directory where php is located", "where to install php", "system disk (e.g. C:)"

Function phpinstall (PHPFilePath, InstallPath, SystemPath)

On Error Resume Next

Set FSO = CreateObject ("Scripting.FileSystemObject")

'WScript.Echo "Delete C:\ PHP"

FSO.DeleteFolder InstallPath

FSO.CopyFolder PHPFilePath, InstallPath 'the first parameter is the name of the php folder you want to install, and its next level is a pile of files and folders, not just one folder

'WScript.Echo "delete C:\ Windows\ system32\ php5ts.dll and C:\ Windows\ system32\ libmysql.dll, and then copy the new"

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 encryption processing

FSO.DeleteFile SystemPath & "\ Windows\ system32\ libmcrypt.dll"

FSO.CopyFile InstallPath & "\ libmcrypt.dll", SystemPath & "\ Windows\ system32\ libmcrypt.dll"

'WScript.Echo "reads the contents of C:\ php\ php.ini-dist to the variable PHPStr"

PHPStr = FSO.OpenTextFile (InstallPath & "\ php.ini-dist", 1, True) .ReadAll

'WScript.Echo' replaces some parameters in the profile variable 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")

'safe

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 "saves the modified profile variable PHPStr as: C:\ Windows\ php.ini"

FSO.CreateTextFile (SystemPath & "\ Windows\ php.ini", True) .WriteLine PHPStr

Set IIsWebServiceObj = GetObject ("IIS://localhost/W3SVC")

WScript.Echo "add web service extension (open IIS6-- > web service extension-- > right-click blank, add)"

'' WebSvcExtRestrictionList

TempStr = "1," & InstallPath & "\ php5isapi.dll,1,php,php extension"

For Each Str in IIsWebServiceObj.WebSvcExtRestrictionList

If (InStr (Str, "php") = 0) Then

TempStr = TempStr & Liu Yongfa & Str

End If

Next

IIsWebServiceObj.WebSvcExtRestrictionList = Split (TempStr, "Liu Yongfa")

IIsWebServiceObj.SetInfo

'WScript.Echo' add application extension mapping (site properties-> home directory-> configuration-> mapping-> add) "

'' 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 & Liu Yongfa & Str

End If

Next

IIsWebServiceObj.ScriptMaps = Split (TempStr, "Liu Yongfa")

IIsWebServiceObj.SetInfo

'default home page

'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 environment installation is complete, in order to thank the author of this program: Liu Yongfa, please laugh three times ^ _ ^"

End Function

Thank you for reading! This is the end of this article on "sample Analysis of PHP installation script PHPInstall.vbs V3.1 in iis". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Files Liu Yong folders configuration scripts contents variables directories examples analysis parameters more programs articles services good practical security code author Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information NVidia MariaDB Shulou Tech Info Huawei