inchirags@gmail.com Chirag's Windows Tutorial https://www.chirags.in
*********************************************************************************************
Install and Configure PHP in IIS Manager in Windows Server 2022
*********************************************************************************************
The Microsoft Web Platform Installer (WebPI) was retired on December 31, 2022.
Step 1: Microsoft Visual C++ Redistributable latest supported downloads
https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2015-2017-2019-and-2022
https://aka.ms/vs/17/release/vc_redist.x64.exe
Step 2: Zip File Installation
To use the Zip file installation, follow the instructions in Using FastCGI to Host PHP Applications on IIS 7.0 and Above. The Zip file installation installs many of the extensions that are available for the Windows Installer version; however, none of the extensions are enabled until their entries in the Php.ini file are set up.
Download the latest non-thread-safe Zip file package with binaries of PHP. Under Windows Binaries, click on the most current "PHP non-thread-safe Zip package" to download the PHP files.
https://www.php.net/downloads.php
https://windows.php.net/downloads/releases/php-8.3.12-nts-Win32-vs16-x64.zip
Unpack the files to a directory of your choice (for example, C:\PHP) on your IIS server.
Step 3: php.ini file configuration
Rename the
Php.ini-development
to
php.ini
Open the Php.ini file in a text editor, then uncomment and modify settings as follows:
Set fastcgi.impersonate = 1
FastCGI under IIS supports the ability to impersonate security tokens of the calling client. This allows IIS to define the security context that the request runs under.
Set cgi.fix_pathinfo = 0
The cgi.fix_pathinfo provides PATH_INFO/PATH_TRANSLATED support for Common Gateway Interface (CGI). Setting this to 1 will cause PHP CGI to fix its paths to conform to the specification.
Set cgi.force_redirect = 0
Set open_basedir to point to a folder or network path where the content of the Web site(s) is located.
C:\ApplicationPoolPHP
Set extension_dir to point to a location where PHP extensions reside. For PHP 5.2.X, this is typically
extension_dir = "./ext"
Set error_log="C:\php_errors.log"
This can help with troubleshooting.
Enable the required PHP extension by un-commenting corresponding lines. More information follows in the section, Extensions.
Step 4: Setting Environment Variables
Click on Start, Settings, Control Panel, and then double-click on the System icon (using the class view).
Click on the Advanced system settings link in the left column.
From the System Properties window, click on the Advanced tab, and then click on the Environment Variables button at the bottom.
Select the Path variable from the System Variables section, and then click on Edit. Add:
c:\php
to your system path.
Click OK until you have exited the System Properties window.
Step 5: Configure IIS Manager
Server Manager -> Add roles and features -> Role-based or feature-based installation -> Next ->
select checkbox "Web Server (IIS)" and "CGI" is under the Web Server (IIS) > Application Development section.
-> Next -> Install
Note: Install features as per your requirement.
Step 6: configure Handler Mappings
Start IIS Manager by clicking on Start, Programs, Administrative Tools, and then Internet Information Services (IIS) Manager.
From the IIS Manager, click on the hostname of your server in the Connections panel on the left.
Double-click on the Handler Mappings icon.
From the Handler Mappings Actions panel, click on Add Module Mapping.
Type the following information into the appropriate text boxes, and then click OK.
Request path: *.php
Module : FastCGImodule
Executable: C:\php\php-cgi.exe
Name: FastCGI
Click OK, and then click Yes.
Step 7: Create index.php and default.php pages
In the left panel, click on your server's hostname, and then double-click on the Default Document icon.
From the Actions panel on the right, click Add.
Enter index.php as the new default document name, and then click OK.
Enter default.php as the new default document name, and then click OK.
In the left panel, click on your server's hostname.
In the Actions panel on the right, click Restart.
Step 7: Create phpinfo.php and check the php configurations.
Create a new text document, and save it as
c:\inetpub\wwwroot\phpinfo.php
with the following content:
<?php phpinfo(); ?>
You should now see the PHP information page at
http://localhost/phpinfo.php
For any doubts and query, please write on YouTube video comments section.
Note : Flow the Process shown in video.
Please, Subscribe and like for more videos:
https://www.youtube.com/@chiragstutorial
Don't forget to, Follow, Like, Share &, Comment
Thanks & Regards,
Chitt Ranjan Mahto "Chirag"
_____________________________________________________________________
Note: All scripts used in this demo will be available in our website.
Link will be available in description.
#chirags
#chiragstutorial
#chiragsphptutorial
#chiragstutorials
#phptutorial
#phpwithiis
#php