Disable PHP IIS 8.5

Efff dd 576 Reputation points
2022-11-14T15:54:37.933+00:00

Hello
I would like to stop PHP without uninstalling, just in case I need to turn it back on.
slowly decommissioning a IIS server and sites.

thanks

Windows development | Internet Information Services
Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Dillon Silzer 60,701 Reputation points Volunteer Moderator
    2022-11-14T16:17:23.277+00:00

    Hi @Efff dd

    You could try disabling the php-cgi.exe service from startup services.

    ------------------------------

    If this is helpful please accept answer.

    0 comments No comments

  2. Sam Wu-MSFT 7,566 Reputation points Microsoft External Staff
    2022-11-15T02:40:13.777+00:00

    @Efff dd

    There are many ways can do it:

    • You can directly stop the website where php is used, just click Stop from that panel, when you need to start again, just Start from there.

    260294-1.png

    • Using Request Filtering module disable all requests to files with .php extension.
       <system.webServer>  
          <security>  
              <requestFiltering>  
                  <fileExtensions>  
                      <add fileExtension=".php" allowed="false" />  
                  </fileExtensions>  
              </requestFiltering>  
          </security>  
      </system.webServer>  
      
    • Using URL Rewrite module create a rule to redirect to your own error page for all of such php requests.
          <rewrite>  
              <rules>  
                  <clear />  
                  <rule name="Show Our Error Page for PHP files" stopProcessing="true">  
                      <match url="^.*\.php$" />  
                      <action type="Rewrite" url="/404.php" />  
                  </rule>  
              </rules>  
          </rewrite>  
      

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.