Praktikum 3: Difference between revisions
No edit summary |
No edit summary |
||
| Line 4: | Line 4: | ||
This practical guide outlines the steps to install IIS (Internet Information Services) with PHP support on a Windows Server. Follow the instructions carefully and ensure all configurations are completed as described. |
This practical guide outlines the steps to install IIS (Internet Information Services) with PHP support on a Windows Server. Follow the instructions carefully and ensure all configurations are completed as described. |
||
1. Install Required Programs |
|||
Install Visual C++ Redistributable: |
Install Visual C++ Redistributable: |
||
Download the latest version of the Visual C++ Redistributable for Visual Studio from |
Download the latest version of the Visual C++ Redistributable for Visual Studio from [https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170] |
||
[https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170] |
|||
Ensure you download the x64 version. |
Ensure you download the x64 version. |
||
| Line 18: | Line 16: | ||
Download PHP: |
Download PHP: |
||
Visit http://windows.php.net/download/ |
Visit [http://windows.php.net/download/] |
||
Download the latest stable release of PHP (Non-Thread Safe, x64 version). |
Download the latest stable release of PHP (Non-Thread Safe, x64 version). |
||
| Line 34: | Line 32: | ||
Complete the installation and restart IIS or the entire server to apply changes. |
Complete the installation and restart IIS or the entire server to apply changes. |
||
Configure PHP |
2. Configure PHP |
||
Locate and Prepare the PHP Configuration File:In C:\PHP, find the file php.ini-production. |
Locate and Prepare the PHP Configuration File:In C:\PHP, find the file php.ini-production. |
||
We will now copy the php.ini-production configuration to the “working” copy “php.ini” (rename |
We will now copy the php.ini-production configuration to the “working” copy “php.ini” (rename the php.ini-production) and then make some adjustments, using the Command Prompt run the following command: |
||
the php.ini-production) and then make some adjustments, using the Command Prompt run the |
|||
following command: |
|||
copy C:\PHP\php.ini-production C:\PHP\php.ini |
copy C:\PHP\php.ini-production C:\PHP\php.ini |
||
| Line 73: | Line 67: | ||
Navigate to the server's name in the left-hand panel and double-click Handler Mappings. |
Navigate to the server's name in the left-hand panel and double-click Handler Mappings. |
||
[[File:Iis02.png|400px]] |
[[File:Iis02.png|400px]] |
||
Click Add Module Mapping: |
Click Add Module Mapping: |
||
[[File:Iis03.png|400px]] |
[[File:Iis03.png|400px]] |
||
Set the following: |
Set the following: |
||
[[File:Iis04.png|400px]] |
[[File:Iis04.png|400px]] |
||
Request path: *.phpModule: FastCGIModule |
|||
Request path: *.php |
|||
Module: FastCGIModule |
|||
Executable: C:\PHP\php-cgi.exe |
Executable: C:\PHP\php-cgi.exe |
||
| Line 90: | Line 92: | ||
Name: PHP |
Name: PHP |
||
IMPORTANT: Click Request Restrictions > Check "Invoke handler only if request is mapped to a file." |
'''IMPORTANT:''' Click Request Restrictions > Check "Invoke handler only if request is mapped to a file." |
||
[[File:Iis05.png|400px]] |
[[File:Iis05.png|400px]] |
||
Confirm all changes. |
Confirm all changes. |
||
| ⚫ | |||
| ⚫ | |||
In IIS Manager, navigate to the server's name and double-click Default Document. |
In IIS Manager, navigate to the server's name and double-click Default Document. |
||
[[File:Iis06.png|400px]] |
[[File:Iis06.png|400px]] |
||
Click Add at the right section and enter index.php. |
Click Add at the right section and enter index.php. |
||
[[File:Iis07.png|400px]] |
[[File:Iis07.png|400px]] |
||
Save the changes. |
Save the changes. |
||
| Line 111: | Line 119: | ||
Test the Configuration |
Test the Configuration |
||
Create the index.php |
Create the index.php file: |
||
Navigate to C:\inetpub\wwwroot. |
Navigate to C:\inetpub\wwwroot. |
||
| Line 125: | Line 133: | ||
Open a browser and navigate to http://localhost/index.php. |
Open a browser and navigate to http://localhost/index.php. |
||
Ensure that the PHP info page is displayed, confirming that PHP is installed and configured |
Ensure that the PHP info page is displayed, confirming that PHP is installed and configured correctly. |
||
correctly. |
|||
Show it to the teacher! |
Show it to the teacher! |
||
| Line 133: | Line 139: | ||
| ⚫ | |||
| ⚫ | |||
Install an FTP Server |
Install an FTP Server |
||
| Line 166: | Line 165: | ||
[http://blog.bobbyallen.me/2016/05/02/installing-php7-on-windows-server-2012-r2-and-iis-8/ Installing PHP7 on Windows Server] |
|||
| ⚫ | |||
Installida IIS PHP toetusega ([https://windows.php.net/download/ PHP 8x64 Non Thread Safe]), kasutades järgmist [http://blog.bobbyallen.me/2016/05/02/installing-php7-on-windows-server-2012-r2-and-iis-8/ juhendit] and VC++ alla laadida [https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170 siit] |
|||
| ⚫ | |||
Revision as of 14:26, 25 December 2024
Install IIS with PHP Support (Windows Server)
This practical guide outlines the steps to install IIS (Internet Information Services) with PHP support on a Windows Server. Follow the instructions carefully and ensure all configurations are completed as described.
1. Install Required Programs
Install Visual C++ Redistributable:
Download the latest version of the Visual C++ Redistributable for Visual Studio from [1]
Ensure you download the x64 version.
Install the runtime and restart the server.
Download PHP:
Visit [2]
Download the latest stable release of PHP (Non-Thread Safe, x64 version).
Extract the downloaded ZIP file to C:\PHP.
Install IIS and Enable CGI Module:
Open Server Manager > Add Roles and Features.
In the "Application Development" section, enable the CGI module.
Complete the installation and restart IIS or the entire server to apply changes.
2. Configure PHP
Locate and Prepare the PHP Configuration File:In C:\PHP, find the file php.ini-production.
We will now copy the php.ini-production configuration to the “working” copy “php.ini” (rename the php.ini-production) and then make some adjustments, using the Command Prompt run the following command:
copy C:\PHP\php.ini-production C:\PHP\php.ini
Edit php.ini File:
Open the php.ini file in a text editor and make the following changes:
Set the timezone:
date.timezone = Europe/Tallinn
Set the extensions directory:
extension_dir = "ext"
Update CGI settings for IIS:
cgi.force_redirect = 0
cgi.fix_pathinfo = 0
fastcgi.impersonate = 1
Save the changes.
Add PHP to IIS:
Open IIS Manager.
Navigate to the server's name in the left-hand panel and double-click Handler Mappings.
Click Add Module Mapping:
Set the following:
Request path: *.php
Module: FastCGIModule
Executable: C:\PHP\php-cgi.exe
Name: PHP
IMPORTANT: Click Request Restrictions > Check "Invoke handler only if request is mapped to a file."
Confirm all changes.
3. Set Default Document:
In IIS Manager, navigate to the server's name and double-click Default Document.
Click Add at the right section and enter index.php.
Save the changes.
Test the Configuration
Create the index.php file:
Navigate to C:\inetpub\wwwroot.
Create a new file named index.php and insert the following content:
<?php phpinfo();?>
Save the file.
Verify the Installation:
Open a browser and navigate to http://localhost/index.php.
Ensure that the PHP info page is displayed, confirming that PHP is installed and configured correctly.
Show it to the teacher!
Optional!
Install an FTP Server
Install and Configure FTP:
Install an FTP server through IIS (optional).
Follow the IIS FTP setup documentation if required.
Create Shared Folder:
Create a folder named after your name (e.g., C:\shared\yourname) to store your files for this
practicum.
Completion Steps
Clean Up:
Ensure all files and configurations are correct.
Verify functionality by demonstrating the index.php file output to the teacher.