"Then it is dark; a night where kings in golden suits ride elephants over the mountains." - John Cheever

Tuesday, August 28, 2012

PHP: fcgid and flush()

(Hi guys, long time no speak. This post is really just so I have a note of this myself and hopefully useful for anyone else googling the same issue...)

We had an issue with some PHP scripts timing out so tried to get the script to return some empty text just to keep the connection alive. What a pain! Finally I figured out the three things that were required:

1.
FcgidOutputBufferSize 0
in your fcgid config file (/etc/apache2/conf.d/fcgid.conf in my case, on Ubuntu 10.04)

2.
output_buffering = Off
in your PHP config file (/etc/php5/cgi/php.ini in my case, on Ubuntu 10.04)

3. And this was the real pain, because I spent ages testing with a file that was never going to work!!

You need to send at least 1024 bytes (1K) before you can flush(). This is the code for my *working* test file:

echo str_repeat(" ", 1024);
echo "Test1";

flush();

sleep(3);

echo str_repeat(" ", 1024);
echo "Test2";

(blogger doesn't like me putting the opening and closing php tags around that code, but they should be there)

If it's working correctly, you should see the first line, then three seconds later the second line. If it's not working correctly, it will wait for three seconds and load both lines at the same time.

Hope this helps someone!

Monday, October 18, 2010

Thursday, September 16, 2010

Monday, September 06, 2010

OpenDNS - Internet Navigation And Security

As my 7 year old daughter now googles things I thought it was time to get some parental controls installed for my home network's internet connection. After a bit of researching OpenDNS seems to be an excellent (and free) solution. Much better than paying for iffy software that would then have to be installed on all the PCs in the house.

Friday, August 27, 2010

Brian Keenan / Jah Wobble

Claire and I went to readings / Q&A sessions with first Brian Keenan and then Jah Wobble at the Book Festival yesterday. Both of them pretty amazing individuals.

Thursday, August 26, 2010

Moray Place BBQ

From Moray Place BBQ

Seumas your attendance is definitely required at the next one. Plenty of money left in the adwords kitty...

Monday, August 16, 2010

Cycle ride home as tracked by Google Latitude

My cycle ride home (KML data exported from Google Latitude running on my Nokia E72 and imported into Google Maps).


View Cycle ride home 20100816 in a larger map

Google Latitude location history

I thought you might be able to do this - track Google latitude location history. Interesting and slightly unnerving, have just turned mine on.