Praktikum 3: Difference between revisions
No edit summary |
No edit summary |
||
| (6 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
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 |
1. Install Required Programs |
||
| Line 31: | 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. |
||
2. Configure PHP |
2. Configure PHP |
||
| Line 38: | Line 40: | ||
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: |
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 |
<pre>copy C:\PHP\php.ini-production C:\PHP\php.ini</pre> |
||
Edit php.ini File: |
Edit php.ini File: |
||
| Line 46: | Line 48: | ||
Set the timezone: |
Set the timezone: |
||
date.timezone = Europe/Tallinn |
<pre>date.timezone = Europe/Tallinn</pre> |
||
Set the extensions directory: |
Set the extensions directory: |
||
extension_dir = "ext" |
<pre>extension_dir = "ext"</pre> |
||
Update CGI settings for IIS: |
Update CGI settings for IIS: |
||
cgi.force_redirect = 0 |
<pre>cgi.force_redirect = 0 |
||
cgi.fix_pathinfo = 0 |
cgi.fix_pathinfo = 0 |
||
fastcgi.impersonate = 1 |
fastcgi.impersonate = 1 |
||
</pre> |
|||
Save the changes. |
Save the changes. |
||
Add PHP to IIS: |
3. Add PHP to IIS: |
||
Open IIS Manager. |
Open IIS Manager. |
||
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]] |
||
| Line 73: | Line 76: | ||
Click Add Module Mapping: |
Click Add Module Mapping: |
||
[[File:Iis03.png|400px]] |
[[File:Iis03.png|400px]] |
||
| Line 79: | Line 81: | ||
Set the following: |
Set the following: |
||
[[File:Iis04.png|400px]] |
[[File:Iis04.png|400px]] |
||
<pre> |
|||
Request path: *.php |
Request path: *.php |
||
Module: FastCGIModule |
Module: FastCGIModule |
||
Executable: C:\PHP\php-cgi.exe |
Executable: C:\PHP\php-cgi.exe |
||
Name: PHP |
Name: PHP |
||
</pre> |
|||
'''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]] |
||
| Line 101: | Line 99: | ||
4. Set Default Document: |
|||
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]] |
||
| Line 110: | Line 107: | ||
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]] |
||
| Line 124: | Line 120: | ||
Create a new file named index.php and insert the following content: |
Create a new file named index.php and insert the following content: |
||
<pre> |
|||
<?php phpinfo();?> |
<?php phpinfo();?> |
||
</pre> |
|||
Save the file. |
Save the file. |
||
| Line 165: | Line 161: | ||
[http://blog.bobbyallen.me/2016/05/02/installing-php7-on-windows-server-2012-r2-and-iis-8/ |
[http://blog.bobbyallen.me/2016/05/02/installing-php7-on-windows-server-2012-r2-and-iis-8/ Source] |
||
[https://neoserver.site/help/setting-ftp-server-windows-server-2016 |
[https://neoserver.site/help/setting-ftp-server-windows-server-2016 Source] |
||
Latest revision as of 14:47, 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.
3. 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.
4. 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.