Praktikum 3: Difference between revisions

From TÜ Narva Kolledži Wiki
Jump to navigation Jump to search
Content deleted Content added
No edit summary
No edit summary
Line 159: Line 159:




[http://blog.bobbyallen.me/2016/05/02/installing-php7-on-windows-server-2012-r2-and-iis-8/ Installing PHP7 on Windows Server]
[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 Setting up an FTP server on Windows Server]
[https://neoserver.site/help/setting-ftp-server-windows-server-2016 Source]

Revision as of 14:46, 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.


Source

Source