IIS & Web & PHP Configuration Dr. Tom Hicks Trinity University Install IIS (Internet Information Services) 1] Open the Control Panel. Push the Programs & Features Button.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 2 P a g e 2] Push the Turn Windows Features On or Off Button. 3] The default configuration is above on the left. Update the choices to match those on the Right above. Push the OK Button. 4] Push the Download Files Button.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 3 P a g e 5] Push the Restart Button. Will probably take about 10 minutes. LOCALHOST LOOPBACK 127.0.0.1 1] Localhost is another name for the loopback which is referenced by Internal IP 127.0.0.1. If the web page loads, you have been successful installing IIS. Try it.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 4 P a g e 2] Try to reach your IIS site with the loopback port 127.0.0.1 3] If you have a Microsoft browser, you can use loopback. 4] All of your IIS components will be installed in folder C:\Inetpub folder C:\ftproot will contain the web stuff. Folder C:\ftproot will contain the ftp stuff. Make sure you have folder C:\Inetpub 5] The web page we saw above was created by the files in c:\inetpub\wwwroot
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 5 P a g e DNS Entry IP Entry 1] Make a note of your IP Address. My static IP Address is 131.194.34.100 2] Go to another computer on our network. When you use another computer on our network verify that you can use a browser to reach your IIS server by using my DNS name. 3] Go to another computer on our network. When I use another computer on our network verify that you can use a browser to reach my IIS server by using my IP Address.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 6 P a g e Website Modification #1 1] Create a folder, called C:\Inetpub\wwwroot\Original Files. Copy the other files, from this folder, into Original Files as shown above. Note that you had to give permission to move the files; this gets to be a hassle confirming things all the time. 2] Note that your website no longer loads. It mentions that you cannot list the contents of the directory; this is a good security setting, but can be somewhat problematic during web site construction. Set Permissions IIS wwwroot 1] We are going to configure the permissions for ASP, PHP, Dot Net, etc.; not all of these permissions will be needed for web services. We are going to open the permissions with Full Control knowing that we can come back and restrict the options later as we move toward a production application. 2] Right-Mouse Click on C:\Inetpub\wwwroot Select Properties
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 7 P a g e 3] Select Properties tab Push the Advanced Button. 4] Push the Disable Inheritance Button. 5] Select Convert Inherited Permissions
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 8 P a g e 6] Select IIS_Usrs Push the Edit Button. 7] We are temporarily going to give all accounts full control; if our database does not respond correctly, we want to know that it is not an issue with Windows Permissions! Push OK Button. 8] Just to simplify things, remove the TrustedInstaller, System, and Creator Owner accounts.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 9 P a g e 9] {Initial/Pledge} I have added accounts thicks, student, Admin, Network, Network Service, & IUSR; all accounts have Full Control Select OK 10] Push the Yes Button. This sets the permissions for ASP, PHP, Dot-Net, Database Access, etc. Default Documents 1] IIS automatically loads any of the default document in the order specified. One of the default documents in index.html.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 10 P a g e 2] Use Notepad++ to create a file, called C:\Inetpub\wwwroot\index.html which contains the data above substituted my name and my server data. 3] Those of you who have some experience with HTML will not be surprised when you access your website and see a page similar to that above. 4] Make the changes shown above, save, and reload your web site.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 11 P a g e e 5] Make sure you get something similar to the data above This data is mine. 6] Make the changes above to your file. 7] When you connect a browser to the website on your server, you should get something similar to the data above The data is mine.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 12 P a g e Start The IIS Manager 1] Push the Administrative Tools Button. 2] Push the Internet Information Services Manager Button. I would also pin the Internet Information Services Manager to the Start Menu and the task bar.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 13 P a g e Set The IIS Default Documents Add index.php 1] Start the IIS Manager. 2] Push the Default Document Button. 3] Push the Add Button.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 14 P a g e 4] Add an entry for index.php. Push the OK Button. 5] Use the Move Up and Move Down buttons to shift index.html and index.php to the top. 5] Hopefully, your default priority looks like that above.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 15 P a g e Set The IIS Directory Browsing 1] Start the IIS Manager. 8] Push the Directory Browsing Button Configure The IIS To Return Error Messages To Browser 1] Start the IIS Manager. 2] This decision will make things easier for us during the design stage. We would tighten it before moving the website into production. Push the Enable Button 3] Push the Error Pages Button
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 16 P a g e 4] Push the Edit Feature Settings Button 5] Select Detailed Errors. Push the OK Button. 6] Push the ASP Button.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 17 P a g e 7] Make Enable Parent Paths True. Make Send errors To Browser True. Push the Apply Button. Test Directory Browsing 1] Renamed index.html the new name is to be Lab-Menu.html. Created directories/folders called ASP-TEST and PHP-TEST. 2] Your wwwroot directory has no default file; turning on directory browsing should enable you to see the selections shown in the graphic above.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 18 P a g e Test Browser Rendering Web Pages Not In IIS Directory 1] Create a file, HTML-Test.html; it should contain the code shown above. Place it on your desktop. 2] Drag file HTML-Test.html on top your web browser. When you do, you should get something like: 3] HTML files can be rendered with any web browser. They do not have to go through the IIS engine.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 19 P a g e Create ASP-Test.asp View ASP Pages Through IIS Web Engine 1] Created file ASP-Test.asp on you desktop. It should contain the code above. 2] There are a number of middleware languages such as ASP and PHP. Middleware languages will only render the desired programming by rendering it through the IIS engine. If you drag file ASP-Test.asp on top your web browser, you will get something like the image seen above. 3] {Initial/Pledge} I have placed a copy of file ASP-Test.asp in folder C:\Inetpub\wwwroot\ASP-TEST
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 20 P a g e 4] {Initial/Pledge} When I look at file ASP-Test.asp through the IIS Engine (by way of localhost) the page renders as shown above. ASP Error Page Verify IIS Error Return Configuration 1] Save a copy of file ASP-Test.asp in folder C:\Inetpub\wwwroot\ASP-TEST; Call it ERROR-Test.asp.Enter xx in the file as shown. There is now a mistake/error in the coding. 2] Render ERROR-Test.asp, You should be able to see the error and the line number of the error. This is the result of returning the error messages to the browser. This is important during web site design. We will be able to see PHP errors as well.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 21 P a g e Download PHP 1] Navigate a browser to the link above. https://windows.php.net/download/ 2] Download the first Non Thread Safe 64-bit version of PHP. 3] Created folder C:\Software\PHP Place the downloaded zip file inside.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 22 P a g e 4] Create folder C:\PHP 5] Placed= a copy of all of the files, from the zip download, into C:\PHP. 6] Configure the permissions of C:\PHP to match those of C:\Initpub\wwwroot they match those above.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 23 P a g e Download & Install Visual C++ Redistributable Required By PhP 1] Navigate Browser to the link above. https://windows.php.net/download/ 2] Download the 64 bit version of the Redistributable. 3] Create folder C:\Software\VC Redistributable 64-bit. Place the download into that folder. Double-Click on the installer. 4] Agree to the conditions and push the Install Button. 5] Push the Yes Button.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 24 P a g e 6] Push the Close Button. Test PHP #1 1] Create file PHP-Test.php and placed it in directory C:\Inetpub\wwwrooot\PHP-Test\, It contains the code above. 2] Things do not work yet because we have not yet configured IIS to map the page to the php engine.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 25 P a g e Configure The IIS To Map PHP Files 1] Start the IIS Manager. 2] Push the Handler Mappings Button. 3] Note that there is no entry for PHP. Push the Module Mapping Button.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 26 P a g e 4] Configure carefully to match the above configuration. Push the OK Button. 5] Push the Yes Button. 6] Return to PHP-Test.php in your browser. It now renders through the web site. PHP is not initialized to handle databases and errors; some customization is still in order. Make sure you can see the PHP info on your page,
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 27 P a g e Create PHP-Test-Error.php 1] Create file PHP-Test-Error.php and place it in directory C:\Inetpub\wwwrooot\PHP-Test\, It should contain the code above. 2] If the web page had 10,000 lines of php code, there would still be no indication of what the error is or where it occurs. This is not very good.
IIS-Web-PHP-Configuration-Key.docx CSCI-3343 28 P a g e 3] Made a copy of file php.ini-development Call it php.ini 4] Reloa the web page You should get a more meaningful error message Something like the page above.. 5] I recommend adding the code above to the top of your php.ini file.