The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP flush() Function Not Working

Discussion in 'General Discussion' started by ddrewa, May 7, 2008.

  1. ddrewa

    ddrewa Registered

    Joined:
    Apr 28, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    I'm running WHM X v3.1.0 and cPanel 11.18.5 on REDHAT Enterprise 4 x86_64.

    I just finished moving some scripts over from my old server and noticed that the PHP flush() function isn't working on this server. Are there any known issues with my WHM/default configuration that prevent flush() from returning input immediately? I've tried changing lots of settings in php.ini and several combinations using flush() and ob_*(), but no success.

    My test script should print ten lines: one line per second. Instead, it prints all ten lines simultaneously--ten seconds from when the script is called.
     
  2. ddrewa

    ddrewa Registered

    Joined:
    Apr 28, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Figured this out. It was being prevented by mod_security.
     
  3. jefferyw18

    jefferyw18 Well-Known Member

    Joined:
    Apr 10, 2004
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Vancouver BC Canada
    cPanel Access Level:
    DataCenter Provider
    where did you see mod_security? in your PHP.INI file, I am having the same issue with mine
     
  4. jefferyw18

    jefferyw18 Well-Known Member

    Joined:
    Apr 10, 2004
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Vancouver BC Canada
    cPanel Access Level:
    DataCenter Provider
    If flush is not working probably mod_gzip is enabled.
    To disable it just add following lines to .htaccess
    PHP:
    <IfModule mod_gzip.c>
    mod_gzip_on no
    </IfModule>
     
  5. ddrewa

    ddrewa Registered

    Joined:
    Apr 28, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    mod_gzip was not running on my server, so that wasn't the problem. you can completely disable mod_security in httpd.conf or you can just disable the rule that's causing the problem (SecResponseBodyAccess) for specific files.
     
Loading...

Share This Page