激活IIS和PHP

I am looking to create a powershell script or a batch file that can turn on IIS and 'active' php (add the proper environment variable [path will be where script is run from]). I looked around and saw things like pkgmgr, however its been depreciated, I need the script to run on computers ranging from Server 03 -> Server 12 and standard boxes like Vista -> Win10.

Which is the best way to achieve this and is there a way to have 1 script run on all boxes or do you need OS checks in the script/different scripts?

IIS and Apache should have different port.

To change the port of Apache(WAMP)

Click on WAMP icon that you can see on your tray or other shortcut icons for wamp.

Look for the Apache and open the httpd.conf or if you know where it is stored.

Find the "80" then change

Listen 80 to Listen 8080

ServerName localhost:80 to ServerName localhost:8080

Note: You can change the port which you desired as long as it will not conflict with your other port. It is more safe and common if the port is at this range.

Then click on Restart All Services.

To change the port of Apache(XAMPP)

  1. Open file \xampp\apache\conf\httpd.conf

search following line(at 47 in default installation):

Listen 80

change the port 80 to another say 8080 as shown below:

Listen 8080

Also search following line(at 181 in default installation)

ServerName localhost:80

and change port 80 to 8080 as shown below:

ServerName localhost:8080

  1. Open \xampp\apache\conf\extra\httpd-ssl.conf file.

search for "Listen 443" and change to "Listen 449"

search for "" and change to ""

search for "ServerName localhost:443" and change to "ServerName localhost:449"

  1. Start the "setup_xampp.bat" and beginning the installation.

  2. Double click on xampp_start.exe. It will start XAMPP.

Note: Do NOT close console window if it is not closed automatically. Keep it opened.

  1. Start your browser and type http://127.0.0.1:8080 or http://localhost:8080 in the location bar. You will see XAMPP start page.

Now, you can work with both IIS and Apache servers.