如何为持久性 PHP FastCGI 进程设计应用程序?
PHP 终于开始变得 TRUE FastCGI 实现。 (不要与 PHP-FPM 或常用的 PHP 进程 启动脚本混淆使用 Nginx - 想想
如何使用这些新的异步模式来设计应用程序 ?
。例如,通常如果有错误或异常,应用程序会记录它,警告用户,然后 die() 的。但是,如果您有一个(几乎)永无休止的守护进程运行,那么您如何处理错误 结束当前请求并移动到下一个?您不能继续您正在做的事情(因为错误) - 但您无法在不终止进程的情况下退出。
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 daemon 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
例如...
您可以将三页代码放入 Something() 中。如果该代码中的任何位置发生错误,您可以简单地跳到循环的下一个迭代,而不是继续当前迭代。
for instance...
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.