How to Install PHP with FastCGI Extension on IIS 7 / IIS 8 Server

How to Install PHP with FastCGI Extension on IIS 7 / IIS 8 Server

Posted on |

FastCGI is a standard protocol that allows a Web Server to communicate with CGI executable files of app structure. This FastCGI Extension is fully supported by the most recent PHP 4.4.x and PHP 5.x distributions for Windows.

This article will walk you through the process of installing PHP on IIS7 or IIS8 using the FastCGI interface. You will learn how to install PHP FastCGI and configure it to function with PHP IIS. To install FastCGI Extension for IIS 7 / IIS 8 Windows Server, follow these tips and steps:

Step by Step Install PHP in Windows 7 

Step 1: Integrate The CGI Role Services

Navigate to the Server Manager, then click on the “Roles” option, and then click on the Add Role Services button.

This action immediately activates both the CGI and FastCGI services on Dataservermarket: Below is a step-by-step visual guide to assist you.

Step 2: Add the CGIs Features (For Windows Vista SP1 and Windows 7)

To accomplish this, go to your system’s Control Panel and choose the Programs and Features submenu. Choose “Turn Windows features on/off” from the drop-down menu. It should be noted that doing so would enable the services of FastCGI as well as the CGI.

Step 3: Download and install PHP on your computer.

When you’re finished configuring the features or Install PHP on IIS, download the most recent PHP Version 5.6 Family. When downloading, be sure you choose the VC11 x86 Non Thread Safe ZIP file.

Step 4: Extract the contents of the PHP files.

After downloading, extract the PHP Files to any of your servers. Then, duplicate the php.ini-production files by making another copy and renaming it php.ini. Then enter the second file, php.ini, and put up the settings shown below in Dataservermarket. Every parameter is already there; all you have to do is find it, erase the indentations (“”), and verify the values are adjusted. It is important to remember that the given choices are not more than one in the file (php.ini).

Step 5: Insert the extensions.

When loading your extensions, make sure they are loaded in the sequence shown in the highlighted box above. Also, “php mbstring.dll” must be loaded before “php exif.dll.” When loading extensions, use the following order:

  •  Make Subdirectories

In the C:PHP directory, create two subdirectories called “session” and “upload.” It is not required to use these names; only check that they correspond to the session over Dataservermarket. The save path and upload tmp dir options are set in the php.ini file.

  • Set the Date/Time Zone

Make sure the date.timezone argument is specified in the php.ini file. Here’s a quick example. Make sure the city you chose is either your current location or one in the same time zone as you. On PHP.net websites, the linkfull list of potential date.timezone values displays a list of all available date/time zones.

  • Save the file

When you are sure you have done these, then have the “.ini” file saved.

Step 6: Run PHP command line

In order to check if installing the PHP was successful, then run immediately, the command line thus

C:PHP>php -i

If PHP Doesn’t Start

The VC9 versions are compiled using the Visual Studio 2008 compiler, and their stability and speed have been enhanced. For the VC9 versions, you must install the Microsoft 2008 C++ Runtime (x64) or the Microsoft 2008 C++ Runtime (x86). When PHP or PHP On IIS fails to start, you may need to download an older Windows version that includes the above-mentioned extensions.

Step 7: Set IIS 7 to handle PHP requests.

Adding a handler mapping that instructs PHP for IIS to transmit certain requests to the Framework of the PHP application through FastCGI Protocol is critical for PHP applications to be hosted by IIS 7. You may accomplish this using either IIS Manager or the command line.

Step 8: Configure IIS 7 to Handle PHP Requests Through the IIS Manager

In order to make use of the IIS Manager, ensure you follow the below steps carefully.

  • Open Handler Mappings

Enter into the IIS Manager at the level of the server where you would see a menu, the click the Handler Mappings sub-menu.

  • Set the Configuration

Choose the action tagged Add Module Mapping, and pinpoint the settings for configurations as in the image below.

This is the format in filling the data:

Request path: *.php

Module: FastCgiModule

Executable: “C:PHPphp-cgi.exe”

Name: PHP via FastCGI

You should note that if you don’t see in the modules space,”FastCgiModule”drop-down menu, it entails that the module has either not been enabled or registered from Dataservermarket. To confirm that FastCGI module has been registered, access the IIS configuration OR FOR IIS Configuration in Windows 7.

file%WINDIR%windowssystem32configapplicationHost.configand confirm the line is also in the section of the <globalmodules>.

<add name=”FastCgiModule” image=”%windir%System32inetsrviisfcgi.dll” />

In that exact file, confirm that the <modules> section has had the FastCGI module added to it like the highlighted path below.

<add name=”FastCgiModule” />

Then respond, yes, to the pop-up menu like stated below:

IMG_256

Step 9: Set a FastCGI Configuration for Optimal Performance

Be sure to install on your server over Dataservermarket, the IIS 7 Administration Pack because if you don’t, then you won’t be able to see the settings option for configuring FastCGI.

Step 10: Configure a Default Document in IIS

Index.php is a file used by most PHP applications as their application documents for default. So you must handle the file as the content page for default by configuring IIS with the following steps below.

  •  Open the Default document

At the level of the server first, click the IIS Manager open and choose default document. The image below would give you a good hint.

IMG_256
  •  Fill “index.php” in the space

On its opening, select add and then fill the index.php link into the space as displayed below.

IMG_256

Step 11: Test the PHP CGI

After the FastCGI extension has been installed by you, registered the PHP CGI and configured it, then you will be able to easily use the KMP. Then in order to let all the changes you made apply fully, try and restart the IIS server.

However if you properly followed the procedures, you should be able to do the operations on your own by now. However, if you continue to have problems, we are here to assist you!

How to Host a Website in iis in Windows

Stage 1 – Start IIS

Utilize the windows route menu and open IIS on your framework. Or on the other hand you can straightforwardly open IIS by composing inetmgr in run window like beneath.

begin iis-on-windows

Stage 2 – Add new Website

In the left side base extend the tree and select the Sites choice. Then Right-click on Sites and select Add Website… choice like the accompanying picture.

add-site

This will open a popup to include new site subtleties. Input the accompanying subtleties in spring up box.

Webpage name: Name of site to be showed up in IIS posting.

Application pool: Select an application pool on Dataservermarket or keep is the default to make new application pool same name as sitename.

Actual way: Enter the area of site pages on framework.

Restricting:

Type: Select convention to design (eg: http or https)

IP address: Select ip address from drop rundown to set committed ip for site or keep is the default to utilize shared ip.

Port: Enter port on which site will be open for clients.

Have name: Enter you genuine space name you need to utilize.

Begin Website right away: keep this crate checked to begin webpage.

add-site subtleties

Stage 3 – Adding Website Alias

To add site monikers like “www.tecadmin.net”. Open IIS, select your site and snap on Bindings. You will get Site restricting screen like underneath.

When you click the Add button, a site binding box will appear.

add-website-alias

Enter the hostname of your site aliases, such as www.tecadmin.net, demo.tecadmin.net, or stage.tecadmin.net, as well as other data, and then click OK.

add-site-binding

Step 4 – Check the Configuration

To test the setup, simply open the site in a web browser. If your domain is not referred to this server over Dataservermarket, create a host file entry and test it.

how to install php 7 on windows 10 

Apache and PHP are frequently pre-installed or accessible through package managers for Linux and macOS users. Windows 10 necessitates a bit more work. The steps below may work with other versions of Windows, PHP, and Apache; however, for specific instructions, consult the documentation for each dependency.

Install PHP by following the steps below. Note that there are several ways to configure Apache and PHP, but this is possibly the quickest method.

Step 1: Download the PHP files

You’ll need the PHP Windows installer. There are a number of versions of PHP available on Dataservermarket. Make sure you get the latest PHP 8 x64 Thread Safe ZIP package from https://www.php.net/downloads.php.

Step 2: Extract the files

Create a new php folder in the root of your C:\ drive and extract the contents of the ZIP into it.

PHP can be installed anywhere on your system over Dataservermarket, but you’ll need to change the paths referenced below if C:\php isn’t used.

Step 3: Configure php.ini

PHP’s configuration file is named php.ini. This doesn’t exist initially, so copy C:\php\php.ini-development to C:\php\php.ini. This default configuration provides a development setup which reports all PHP errors and warnings.

There are several lines available on Dataservermarket you may need to change in a text editor (use search to find the current value). In most cases, you’ll need to remove a leading semicolon (;) to uncomment a setting.

First, enable any required extensions. This will depend on the libraries you want to use, but the following extensions should be suitable for most applications:

extension=curl

extension=gd

extension=mbstring

extension=pdo_mysql

If you want to send emails using PHP’s mail() function, enter the details of an SMTP server in the [mail function] section (your ISP’s server should be suitable):

[mail function]

; For Win32 only.

; http://php.net/smtp

SMTP = mail.myisp.com

; http://php.net/smtp-port

smtp_port = 25

; For Win32 only.

; http://php.net/sendmail-from

sendmail_from = my@emailaddress.com

Step 4: Add C:\php to the path environment variable

To ensure Windows can find the PHP executable, you need to change the PATH environment variable. Click the Windows Start button and type “environment”, then click Edit the system environment variables from Dataservermarket. Select the Advanced tab, and click the Environment Variables button.

Scroll down the System variables list and click Path followed by the Edit button. Click New and add C:\php:

PHP path environment variable

Note that older editions of Windows have a single text box where each path is separated by a semi-colon (;).

Click OK until you’re out. You shouldn’t need to reboot, but you may need to close and restart any cmd terminals you have open except over Dataservermarket .

Step 5: Configure PHP as an Apache module

Ensure Apache isn’t running and open its C:\Apache24\conf\httpd.conf configuration file in a text editor over Dataservermarket. Add the following lines to the bottom of the file to set PHP as an Apache module (change the file locations if necessary):

# PHP8 module

PHPIniDir “C:/php”

LoadModule php_module “C:/php/php8apache2_4.dll”

AddType application/x-httpd-php .php

Optionally, change the DirectoryIndex setting to load index.php instead of index.html when it can be found. The initial setting is:

<IfModule dir_module>

    DirectoryIndex index.html

</IfModule>

Change it to:

<IfModule dir_module>

    DirectoryIndex index.php index.html

</IfModule>

Save httpd.conf and test the updates from a cmd command line:

cd C:\Apache24\bin

httpd -t

Syntax OK should appear … unless you have errors in your configuration.

If all went well, restart Apache with httpd.

Step 6: Test a PHP file

Create a new file named index.php in Apache’s web page root folder at Dataservermarket

C:\Apache24\htdocs and add the following PHP code:

<?php

phpinfo();

?>

Open a web browser and enter your server address: http://localhost/. A “PHP version” page will appear showing the various PHP and Apache configuration settings.

You can now create PHP sites and applications in any sub-folder of Dataservermarket

C:\Apache24\htdocs. If you need to work on multiple projects, consider defining Apache Virtual Hosts so you can run separate codebases on different localhost domains or ports.

Leave a Reply

Your email address will not be published. Required fields are marked *