How to run a PHP application on IIS?

Asked

Viewed 7,925 times

6

I have a PHP website that I want to install on IIS (Apache for Windows is not an option).

It will not run naturally as an . NET application.
So I already downloaded a release of PHP on the site http://windows.php.net, but I still have to configure the IIS to interpret the application in PHP using these dll’s.

How do I do that?

  • Take a look at this article, I believe it will help you. http://technet.microsoft.com/pt-br/library/hh994589.aspx }

  • 1

    > Just a suggestion, the PHP in the IIS does not run as fast as in Apache2, so do not expect your application to be performative.

2 answers

11


This is the hardest way.

Try following steps using the Windows Platform Installer: http://www.microsoft.com/web/downloads/platform.aspx

  1. At the top of the window Web Platform Installer, click on Products.
  2. Click on Structures and select the current version of PHP. (On the date of this reply, the current version is PHP 5.3.13.)
  3. Click on Install.
  4. The Web Platform Installation page displays the version of PHP and its dependencies that will be installed.
  5. Click on Accepted.
  6. Web PI installs PHP packages.
  7. Click on Conclude.
  • 3

    Note: Running PHP on IIS works well, but some features and . htaccess may not work.

  • 2

    @Olimonf. obviously... htaccess is Apache, nothing to do with IIS or PHP. The equivalent is web.config: http://www.iis.net/learn/application-frameworks/install-configure-php-applications-on-iis/translate-htaccess-content-to-iis-webconfig

4

The version to run with php IIS will be NTS. Download here: http://windows.php.net/downloads/releases/php-7.1.5-nts-Win32-VC14-x86.zip. - Link updated to the latest version of the day 07/06/2017

After downloading, unzip and modify these lines within php.ini:

;cgi.force_redirect = 1
;cgi.fix_pathinfo=1
;fastcgi.impersonate = 1

Remove ; from the top and change the cgi.force_redirect directive to 0. It will look like this:

cgi.force_redirect = 0
cgi.fix_pathinfo=1
fastcgi.impersonate = 1

Open the Run menu (windows key + R) and type appwiz.cpl and go on Enable or disable windows features, search for Internet information services -> World wide web services -> Application development resources, check the option CGI so IIS can process CGI and FASTCGI applications. After that, go again in the run menu and type inetmgr to open the IIS manager. Inside the search manager Mappings of Manipulator, double-click left-click and right-click Add Mapping of Modules. Open a screen equal to the image below, change and give OK. IIS is already ready to process pages in php.

inserir a descrição da imagem aqui

Go back to the previous page, go to Standard document and in the right corner Add add index.php.

  • The part of Standard document for me there is no way to work... Any idea? If I try to access a folder, returns "No input file specified."... PS: I also tried to edit the Request Restrictions to accept "File or Folder".

  • In request restrictions leave file! restart IIS and see if anything changes, or restart the computer!!!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.