开发者

How to design applications for persistent PHP FastCGI processes?

PHP is finally starting to get TRUE FastCGI implementations. (Not to be confused with PHP-FPM or PHP process startup scripts commonly used with Nginx - think node.js for PHP.

How do you design applications with these new, asynchronous patterns opening up?

For example, usually if there is an error or exception the app logs it, alerts the user, and die()'s. However, if you have a (almost) never-ending dae开发者_开发百科mon running then how do you handle errors while ending the current request and moving to the next? You can't just continue with what you were doing (because of the error) - yet you can't exit without killing the process.


for instance...

while(1) {
   try {
      something();
   catch (Exception) {
      log();
   }
}

you could put three pages of code in something(). if an error happens anywhere in that code, you could simply skip to the next iteration of the loop instead of continuing on with the current iteration.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜