How To Install PHP On IIS In Windows 10 Step-By-Step | Install IIS On Windows 10

IIS (Internet Information Server) is one of the most powerful web servers from Microsoft that is used to host your Web applications. 
 
Generally IIS is well known for running ASP.NET web applications in Windows and other web servers like WAMP, XAMP etc, are known for running PHP scripts.
 
Microsoft has developed IIS so flexible that you can run PHP scripts on it as well.
 
In this tutorial we will guide you step-by-step to How to install IIS on Windows 10 & then How to install PHP on IIS.


How To Install PHP On IIS In Windows 10 Step-By-Step | Install IIS On Windows 10

Step 1: Install IIS On Windows 10

  • Click Windows 10 Search Bar.
  • Type Control Panel.
  • Click Control Panel.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 1

  • Click Programs and Features.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 2

  • Click Turn Windows features on or off.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 3

  • Click Internet Information Services
  • Click World Wide Web Services
  • Click Application Development Features
  • Tick CGI.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 4

  • Wait for the changes to be applied.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 5

Step 2: Download PHP


How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 6

  • Extract Zip folder to C:\.
  • Name it PHP.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 7

Step 3: Configure PHP.ini

  • Open PHP folder.
  • Copy php.ini-production file & Paste there in the same directory.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 8

  • Rename the copied file as php.ini.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  9

  • Right click on the php.ini file(php). Note that the extension .ini will  not be visible.
  • Open with Notepad.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 11

  • -Press Ctrl + F5 to open search box.
  • Use Up & Down radio buttons, because some of the lines are at top and some are at middle and some are at bottom.
  • ";" is a comment symbol. It means such lines will not be executed.
  • Find the lines below in your php.ini, remove the ";" symbol from their start and make the changes, which I have made.
  • Save these changes as well. 
Find --- extension_dir = "./" ---  Replace with ---  extension_dir = "C:\PHP\ext"
Find --- fastcgi.impersonate=0 --- Replace with ---  fastcgi.impersonate=1
Find --- cgi.fix_pathinfo=0 --- Replace with ---  cgi.fix_pathinfo=0
Find --- cgi.force_redirect=1 Replace with --- cgi.force_redirect=0
Find --- error_log = php_errors.log (remove ";")

Find these lines below and remove only  (";") from their start.

extension=curl
extension=gd2
extension=mbstring
extension=mysqli
extension=pdo_mysql

extension=xmlrpc


How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  12

  • Press Ctrl + S to save the changes.

Step 4: Configure The Environment Variables

  • Click Control Panel
  • Click System and Security

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  13

  • Click System

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  14

  • Click Advanced system settings

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  15

  • Click Environmental Variables

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  16

  • Select Path & click Edit under the System variables Label.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  17

  • Click New.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  18

  • Type C:\PHP
  • Click OK

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  19

Step 5: Configure IIS

  • Type IIS on Windows Search Bar or Type Run.
  • Click Run.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  20

  • Type inetmgr
  • Click OK

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  21

  • Click Handler Mappings.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  22

  • Click Add Module Mapping

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  23

  • On request path: type *.php
  • On Module, select FastCgiModule from dropdown menu
  • On Executable, browse: C:\PHP\php-cgi.exe
  • Name it anything, type FastCGI
  • Click OK.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  24

Step 6: Test The PHP Version

  • On Windows Search Bar Type CMD
  • Right click on it and select as Run as administrator

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  25

  • Type php -version
  • Here it is showing me VCRUNTIME140.dll error because in my computer, The Visual C++ Redistributable Packages is not installed.
  • Check the C:\ drive whether the setup vc_redist.x64.exe is present or not.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  26


How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  27

  • Tick vc_redist.x64.exe
  • Click Next to begin downloading.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  28

  • Click the setup to install.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  29

  • Now type again, php -version on command prompt.
  • You can see that it is not showing the error.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10   30

Step 7: Test A PHP File

  • Click Windows Search Bar
  • Type Notepad
  • Right Click on Notepad
  • Click Run as administrator

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  31

  • Type this HTML code or write your own code in PHP or HTML.

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  32

  • Save As this file in: C:\inetpub\wwwroot as test.php

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  33

  • Click this or type this on your browser's URL bar.
  • http://localhost/test.php
  • You can see that I have successfully configured PHP on IIS in Windows 10

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10  35

  • That's it. You're done. If you like this post, don't forget to share this post with other people. Share your feedback in the comments section below.


Best Web hosting with discount

Recommended Posts


Related Posts

Comments

  1. Thank you so much for such a magnificent tutorial. I was struggling to install IIS on Windows 10 for PHP, but now I have done it.

    ReplyDelete
  2. Thank You so much. It works briliantly!!

    ReplyDelete
  3. Awesome tutorial. How anyone would do this without this info.

    ReplyDelete
  4. Perfect instructions other sites left out important steps -- thanks!

    ReplyDelete
  5. Thank you SO MUCH! Hooked me UP!
    Was sweating the prospect of getting PHP running on a new, extremely powerful laptop.
    This tutorial was spot-on.
    Thanks for posting it!
    Stay safe out there.

    ReplyDelete
  6. Great guide. It is accurate. Thank you a lot

    ReplyDelete
  7. Great guide, I was facing this issue since two days and there was no solution. Thanks you very much.

    ReplyDelete
    Replies
    1. I am facing an issue (as below) during the installation of "Composer" application. Can you help me?

      "
      The Composer installer script was not successful [exit code 1].

      Script Output:
      The "https://getcomposer.org/versions" file could not be downloaded: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. "

      Delete
    2. Please read this article it could help you: https://github.com/composer/windows-setup/issues/91

      Delete
    3. Read this article if above does not work: https://stackoverflow.com/questions/60408035/the-composer-installer-script-did-not-run-correctly-exit-code-1

      Delete
    4. Thanks brother, its was done just I connect through my personal hotspot, my official network (WIFI) was not allowing.

      I am actual new self learner and I am facing much difficulties, like now I stuck to render Twig elements in PHP on IIS server. Since yesterday I am trying but its not showing any result.

      Sorry I am bothering you again and again. If can help me in this Twig issue, I will be very thankful to you.

      BR, Muhammad Azhar Farooq

      Delete
    5. No problem! You're always welcome. To be honest I don' have idea about Twig Elements, but I am suggesting 3 articles that may help you.

      https://ourcodeworld.com/articles/read/1127/how-to-render-a-twig-view-inside-a-command-in-symfony-5

      https://www.codegrepper.com/code-examples/php/twig+render+string+

      https://symfony.com/legacy/doc/cookbook/1_0/en/web_server_iis

      Delete
    6. Many thanks, now at least some simple Twig templates showing contents but with some functions, conditions and loops are not rendered properly, just showing blank white page.

      Thanks again.

      Delete
  8. Thanks a lot. This is what any step by step should be

    ReplyDelete
  9. Thank you so much with the help of your instructions I'm successfully install IIS on windows 10.

    ReplyDelete

Post a Comment