Php controls iis

Source: Internet
Author: User

Next let's take a look at a php online site creation file developed with php that is used to control iis on the webpage and create and delete management sites.

Next let's take a look at a php online site creation file developed with php that is used to control iis on the webpage and create and delete management sites.

<? Php

# PHP controls IIS attributes

# Collection person: Han Xiangzi

# Mailbox: hanxiangzi@gmail.com

# MSN: hanxiangzi@gmail.com

# QQ: 220670
 

/* Site attributes and usage ********************************* ************************/
 
$ LocalHostObject = New Com ("IIS: // localhost/w3svc ");

$ Site = $ LocalHostObject-> Create ("IIsWebServer", Site identifier );

// Site type
$ Site-> Class;

// Site name
$ Site-> ServerComment;
 
// IP address bound to the site: Port: Domain Name
$ Site-> ServerBinDings;

// Site ID
$ Site-> Name;

// Obtain the Home Directory of the site
$ Site-> GetObject ("IIsWebVirtualDir", "ROOT ");
$ Site-> Path;

// The account used for anonymous access
$ Site-> AnonymousUserName;

// Password of the account used for anonymous access
$ Site-> AnonymousUserPass;

// Log file directory
$ Site-> LogFileDirectory;

// Whether FrontPage extension is allowed
$ Site-> FrontPageWeb = True;

// Type of the site
$ Site-> KeyType = "IIsWebServer ";

// Site description
$ Site-> bewrite;

// The bandwidth that can be used. The value is 1024 = 1 K. If the value is 102400 K, the value is.
$ Iissite-> MaxBandwidth = '000000 ';

// How many concurrent IIS connections are allowed, that is, the number of IIS connections.
$ Iissite-> MaxConnections = '000000 ';

// Whether logs are activated
$ Iissite-> LogType = "0"; // 0 indicates that logs in W3C format are not activated, and 1 indicates that logs in W3C format are activated.

// Specify the 404 error. The Url is the file of the current site.
$ Iissite-> HttpErrors = "404,0, Url,/404.htm ";

// Specify the 404 error. The FILE is the absolute path of the current server.
$ Iissite-> HttpErrors = "404,0, FILE,/404.htm ";

// Specify the script ing. You can view some of the default websites for the extension ing. Copy the scripts. The following is an example using PHP.
$ Iissite-> ScriptMaps = ". php, E: softphp-5.2.3-Win32 (1) php5isapi. dll, 5, Get, HEAD ";

/* Default site Documentation ********************************** ***********************/

// Whether the default document is allowed
$ Site-> enabledefadoc Doc = True;

// Default site document
$ Site-> DefaultDoc = "index.php, index.html"; // separated by punctuation marks

/* The running status of the site ********************************** ***********************/

$ SiteStatus = New Com ("IIS: // LocalHost/w3svc/". $ ServerID );

// Site running status
$ SiteStatus-> Status;

// The following integers are returned for the running status:

// 1 indicates that the website is running in "starting"
$ SiteStatus-> Status = 1;

// 2 indicates that the website is in the "started" status"
$ SiteStatus-> Status = 2;

// 3 indicates that the website is in the "Stopping" status"
$ SiteStatus-> Status = 3;

// 4 indicates that the website is in the "STOPPED" status"
$ SiteStatus-> Status = 4;

// 5 indicates that the website is in the "paused" status"
$ SiteStatus-> Status = 5;

// 6 indicates that the website is in the "paused" status"
$ SiteStatus-> Status = 6;

// 7 indicates that the website is running in the "continuing" status, that is, the website continues running after being paused.
$ SiteStatus-> Status = 7;

//-1 indicates an error
$ SiteStatus-> Status =-1;

// Start the site
$ SiteStatus-> Start;
 
// Stop the site
$ SiteStatus-> Stop;

// Continue the website.
$ SiteStatus-> Continue;

// Pause the site
$ SiteStatus-> Pause;

/* Set the site application ********************************* ************************/

$ Iisdir = $ Site-> Create ("IIsWebVirtualDir", "ROOT ");


// Set the site's application to be readable, that is, nothing can be executed
$ Iisdir-> AccessRead = True;

// Set the executable application of the site, including only scripts, excluding execution files
$ Iisdir-> AccessScript = True;

// It is dangerous to set the website's WEB directory to writable.
$ Iisdir-> AccessWrite = True;

// Set the executable application of the site, including scripts and execution files
$ Iisdir-> AccessExecute = True;

// Set the site directory
$ Iisdir-> Path = "d: webuserwebdir ";

// Create a new application
$ Iisdir-> AppCreate (True); // here cannot be = True;, can only be used (True)

// Allow the parent path, that is, allow.
$ Iisdir-> AspEnableParentPaths = True;

/* Application pool related settings ********************************* ************************/

$ AppList = New Com ("IIS: // Localhost/w3svc/AppPools ");

// List the name of the application pool
$ AppList-> Name;

// List the status of the application pool
$ AppList-> AppPoolState;

// The following integers are returned for the running status:

// 1 indicates that the application pool is in the "starting" status"
$ AppList-> Status = 1;

// 2 indicates that the application pool is in the "started" status"
$ AppList-> Status = 2;

// 3 indicates that the application pool is in the "Stopping" status"
$ AppList-> Status = 3;

// 4 indicates that the application pool is in the stopped status"
$ AppList-> Status = 4;

// 5 indicates that the application pool is in the paused state"
$ AppList-> Status = 5;

// 6 indicates that the application pool is in the "paused" status"
$ AppList-> Status = 6;

// 7 indicates that the application pool is in the "running" state, that is, the application pool continues to run after being paused.
$ AppList-> Status = 7;

//-1 indicates an error
$ AppList-> Status =-1;

/* WinNT user and password related settings ******************************** *************************/

$ Usernameobj = New Com ("WinNT: // iim ");

// Create a system user
$ User = $ usernameobj-> Create ("user", $ UserName );

// Set the User Password
$ User-> SetPassword ($ UserPass );

// Set the user's full name
$ User-> FullName = "full user name ";

// Set user description
$ User-> Description = "user Description ";

// Set the user password to be permanently correct
$ User-> UserFlags = & H10000

// Set the user's password to be changed upon next login
$ User-> UserFlags = & H20000

// Set the user's password.
$ User-> UserFlags = & H0040

// Set the user account to be temporarily disabled
$ User-> UserFlags = & H0002


// Create a system user

 


/* Execute related actions *********************************** **********************/

// Execute the preceding actions, but the start, stop, pause, and continue actions in the website running status do not need to be executed-> SetInfo ();
$ Object-> SetInfo (); // $ Object Name of the component you created

?>


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.