Archive for the 'php' Category

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..

Frustrating PHP 4 Objects

Today I tried the following:

function getObject()
{
$object = new Object();
return $object;
}
getObject()->executeMethod();

Well the code above works perfectly …
All great, the app worked, so I’ve committed the project to Subversion.
Upload it to our production server..

Crash!
Well the production server runs PHP4.
Our development server runs PHP5.

In PHP4, You first must put the result of the method call in a variable…

$obj = getObject();
$obj->executeMethod();

*sigh* Sometimes I hate PHP!