Praktikum 3: Difference between revisions
No edit summary |
No edit summary |
||
| Line 72: | Line 72: | ||
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]] |
|||
Click Add Module Mapping: |
|||
Set the following: |
Set the following: |
||
Revision as of 14:09, 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.
Install Required Programs
Install Visual C++ Redistributable:
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
Ensure you download the x64 version.
Install the runtime and restart the server.
Download PHP:
Visit http://windows.php.net/download/
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.
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: *.phpModule: 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.
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.
Installida IIS PHP toetusega (PHP 8x64 Non Thread Safe), kasutades järgmist juhendit and VC++ alla laadida siit
Soovi korral - Installida FTP server [1]