| Journal Home Official Blog |
register_shutdown_function(...) doesn't work with ob_gzhandler(...)[I have decided to start adding some entries about the re-factoring of journal home, either it will help someone else or someone will be able to offer some comments] I am busy doing a lot of changes to the code of Journalhome.com to ensure that it runs better than the current software, (that is no longer supported in any case). My aim is to speed up the whole delivery of the page to the browsers. The problem with that is that some code that I want to be executed at the very end of the script, (as the script is completing) it does not seem to be executed. In php when you call ob_start('ob_gzhandler'); it tells the php compiler to take all the output, (everything going to the screen), and, instead of sending it to the screen we will send the string to a function called ob_gzhandler who in turn will return a compressed string. Normally the way it works is:
With ob_start( ... ) it is a litte bit more complex
What this means is that the created page is sent out as one big string to the browser.
The problem with that is the function ob_gzhandler(...) does not seem to allow the "Do do some completion code" The problem is almost certainly with register_shutdown_function(...), because as the manual clearly says, if any of the registered function call exit() then the processing will stop completely and no other registered function will be called. The other bigger problem with that logic, (and kind of backs up my theory), is that it seems to allow _some_of the registered code to be completed. This makes sense as the shutdown functions are called in the order they are registered so the ones registered before ob_start('ob_gzhandler'); will be executed but not the ones after. For example...
This works as expected with PHP 5.x and later, but not with php 4.x, (well not with php 4.4.x that I am using).
This will also not work with all flavours of php4.x but it will work with php5.x As I am planning to move to php 5 this is not a problem but I am trying very hard to make sure that he new code works on both 4.x and 5.x, (simply because I want the code to be open source. The 'fix' I have is to remove the compression altogether with php < 5.x
Obviously this is not a perfect solution as the code is no longer compressed, but for those that will be using php4, (that is no longer supported btw), then it will have to do. 7:22 AM - 8/6/2008 - post comment
Share and enjoy
|
Description JournalHome.com has created this blog for the purpose of keeping members and visitors up to date with JournalHome.com site information. The easiest way to stay up to date is by using the RSS/XML feed. Place this URL within your rss aggregator and it will automatically update itself whenever a new journal entry is published. If you have any questions which is not answered within this blog then feel free to contact me or post on our forum. Calendar
Home My Wall User Profile Archives Friends My Twitter...More ... Webmaster Forum Free Blog Free Blog Recent Entries - Google Gmail is for spammers only - Monkeys on the line... - To all the JournalSpace.com users. - is GMail only for spammers? - Turned bad-behavior back on |
||||||||||||||||||||||||||||||||||||||||||||