IIS PHP installation script Phpinstall.vbs V3.1_vbs

Source: Internet
Author: User
Tags install php win32
Copy Code code as follows:

'/*=========================================================================
' * Intro PHP installation script, you have to do is: Save this file and to install the PHP folder together (not in the C-packing directory)
' * (current version Php-5.2.5-win32 if it is other please replace the current document related file name), and then double-click to run this file, <?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 "Start Configuring PHP"
Phpinstall "Php-5.2.5-win32", "D:\PHP525", "C:"
"Phpinstall" PHP directory, "Where to install PHP", "system disk (such as: 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 his next level is a bunch of files and folders, not just a single folder

' WScript.Echo ' Deletes C:\Windows\system32\php5ts.dll and C:\Windows\system32\libmysql.dll, and then copies 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 C:\php\php.ini-dist content to variable phpstr '
Phpstr = FSO. OpenTextFile (InstallPath & "\php.ini-dist", 1, True). ReadAll

' WScript.Echo ' replaces some of the parameters in the configuration file 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 configuration file 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 Extensions (Open Iis6-->web service Extensions--> 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 Yong fa" & Str
End If
Next

Iiswebserviceobj.websvcextrestrictionlist = Split (TempStr, "Liu Yong FA")
Iiswebserviceobj.setinfo

' WScript.Echo ' Add Application Extension mappings (Site Properties--> home directory--> configuration--> Mappings--> 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 Yong fa" & Str
End If
Next

Iiswebserviceobj.scriptmaps = Split (TempStr, "Liu Yong FA")
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 completed, in order to this program author: Liu Yong FA, thank you, please laugh three sound ^_^"
End Function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.