Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP flush stopped flushing in IIS 8

Tags:

php

iis

flush

iis-8

Note: I know this looks like a duplicate of this question. I don't see how it is a duplicate. I already stated that I have checked that question, and I tried all the answers, but it didn't work.

Here is what I tried:

  1. Under Dario's answer, I followed the steps but didn't find any php under name section

  2. On the accepted answer I run the same code on command line prompt but it shows:

    appcmd.exe set config /section:handlers "/[name='PHP55_via_FastCGI'].ResponseBufferLimit:0"
    

    and that returns this:

    ERROR ( message:Cannot find requested collection element. )

  3. Then I checked the PHP manual:

    flush manual

    i didn't find anything in that config file like _via_FastCGI

  4. I checked Plesk's PHP setting and yes my server is running on FastCGI mode.

So, I have worked so many hours on my development server for that flush part and now on my live server it is not working. Any help will be highly appreciated

Update 1:

as suggested by @artlung, i have attached the screenshot here:

FAST CGI HANDLERS

Update 2:

Here is what i found in notepad++ by searching with keyword "FastCGI"

<add name="FastCgiModule" lockItem="true" />
<add name="PleskEngine-FastCGI-html" path="*.html" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\admin\bin\php-cgi.exe|-dauto_prepend_file=auth.php" resourceType="Either" responseBufferLimit="0" />
<add name="PleskEngine-FastCGI-html" path="*.html" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\admin\bin\php-cgi.exe|-dauto_prepend_file=auth.php" resourceType="Either" responseBufferLimit="0" />
<add name="PleskEngine-FastCGI-php3" path="*.php3" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\admin\bin\php-cgi.exe|-dauto_prepend_file=auth.php" resourceType="Either" responseBufferLimit="0" />
<add name="PleskEngine-FastCGI-php3" path="*.php3" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\admin\bin\php-cgi.exe|-dauto_prepend_file=auth.php" resourceType="Either" responseBufferLimit="0" />
<add name="PleskEngine-FastCGI-php" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\admin\bin\php-cgi.exe|-dauto_prepend_file=auth.php" resourceType="Either" responseBufferLimit="0" />
<add name="PleskEngine-FastCGI-php" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\admin\bin\php-cgi.exe|-dauto_prepend_file=auth.php" resourceType="Either" responseBufferLimit="0" />
<add name="PHP-phtml" path="*.phtml" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP55\php-cgi.exe" resourceType="Either" />
<add name="PHP-php3" path="*.php3" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP55\php-cgi.exe" resourceType="Either" />
<add name="PHP-php" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP55\php-cgi.exe" resourceType="Either" />
<add name="PHP-phtml" path="*.phtml" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP55\php-cgi.exe" resourceType="Either" />
<add name="PHP-php3" path="*.php3" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP55\php-cgi.exe" resourceType="Either" />
<add name="PHP-php" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP55\php-cgi.exe" resourceType="Either" />
<add name="PHP-phtml" path="*.phtml" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP55\php-cgi.exe" resourceType="Either" />
<add name="PHP-php3" path="*.php3" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP55\php-cgi.exe" resourceType="Either" />
<add name="PHP-php" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP55\php-cgi.exe" resourceType="Either" />
like image 691
Zakir_SZH Avatar asked May 19 '16 06:05

Zakir_SZH


2 Answers

appcmd.exe set config /section:handlers "/[name='NAME'].ResponseBufferLimit:0"

Change NAME to the name of handler you want to update e.g. PHP7_via_FastCGI.

Check the paths, It should solve your issue, I had the same issue and this method helped me.

like image 54
Gammer Avatar answered Nov 06 '22 23:11

Gammer


There are many features and their settings that may conflict with each other in IIS.

It seems like you could not be able to set responseBufferLimit for your handler.

You need to know what's your handler's name first.

Open a command prompt and run:

%windir%\system32\inetsrv\appcmd.exe list config -section:system.webServer/handlers | find "FastCGI"

It's possible to have more than one handler listed like below and that's ok. Yours is the top one, in here it's PHP53_via_FastCGI.

<add name="PHP53_via_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.3\php-cgi.exe" resourceType="Either" />
<add name="PHP54_via_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.4\php-cgi.exe" resourceType="Either" /
<add name="PHP55_via_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.5\php-cgi.exe" resourceType="Either" />
<add name="PHP56_via_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.6\php-cgi.exe" resourceType="Either" />
<add name="PHP70_via_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v7.0\php-cgi.exe" resourceType="Either" />

By replacing PHP53_via_FastCGI with yours, run the following command to change the responseBufferLimit:

%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/handlers /[name='PHP53_via_FastCGI'].responseBufferLimit:"0" /commit:apphost

restart the IIS by running:

iisreset

Try the load php page again.

If still not works as expected, you can be sure that it's because of IIS's Dynamic Compression. Since it handles all dynamic responses with content type text/* by default, when it's enabled it could block a PHP response to compress.

You can temporarily disable dynamic compression to see if it works. Take a back up your web site's web.config and put the following instead, and try to load your PHP page.

web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <urlCompression doDynamicCompression="false" />
    </system.webServer>
</configuration>

In case you don't want to disable dynamic compression for all the web site, there are other levels you can disable dynamic compression for virtual applications, physical and virtual directories or a specific file.

For more information have a look at HTTP Compression Feature Requirements

like image 3
Kul-Tigin Avatar answered Nov 06 '22 23:11

Kul-Tigin