PHP’s Frustrating Flush

PHP not listening when you try to flush data. Try the following, it helped for me:

@ob_flush(); // try a normal flush
flush();

If PHP isn’t flushing it could be your webserver that’s collecting your output for gzipping:


mod_gzip_on no

This worked for me..

Apache Authentication and Mongrel Cluster

Currently I’m running a mongrel cluster for my rails application. This works much nicer then the FastCGI version.
There was only one problem, I had an .htaccess file to restrict access to the public directory.

AuthName "Somewhere"
AuthType Basic
AuthUserFile /home/nobody/.htpasswd
Require valid-user

The problem was I needed to enter this login data 2 times.
Well after doing some google research I found out the problem was the location of the authorizationcode. I think the .htaccess file is used by every Process of the ProxyBalancer… But I’m not sure…

The solution for this problem was to place the authorization code in the proxy balancer:

<Proxy balancer://my_cluster>
  BalancerMember http://rails_site:5532
  BalancerMember http://rails_site:5533
  AuthName "Somewhere"
  AuthType Basic
  AuthUserFile /home/nobody/.htpasswd
  Require valid-user
</Proxy>

That’s all ;-)