PHP on IIS in Windows

  • 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:PHPext”
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.
  • 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:PHPphp-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:inetpubwwwroot 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

About Damon Luong

San Jose, California
This entry was posted in PHP. Bookmark the permalink.