Zend Auth locked session

折月煮酒 提交于 2019-12-12 15:36:57

问题


i nearly frustrated with how Zend handling session.

here is my case. i write a auth plugin that always check the the user credential utilize Zend_Auth. and when invoke hasIdentity function from zend auth, it will automatically start the session.

and the problem come when i have a long process that i need to execute. the session will lock the request until request completed. i try to release the lock by invoke Zend_Session::writeClose(false), so another request can be executed. but no way for me to start the session again.

is it a bad implementation if i try to resume stoped session?

there is only one session from the start until request execution ended?

thanks.

ps : i can do a little hack here. at the end of auth plugin i write a native php function (session_write_close) and if any controller need to use session again, i start it again with (session_start).


回答1:


The easiest solution to this problem is to use a database for session storage. No file locks to worry about (as ArneRie mentined).

Option 1

Use a common PHP extension and a tiny tweak to php.ini:

You can store them on a NFS export or recode the session_set_save_handler using a SQL backend for example. But there is no solution more efficient, more scalable, more performant and easier to deploy than using memcached…

Tutorial: http://www.dotdeb.org/2008/08/25/storing-your-php-sessions-using-memcached/

Option 2

The Zend way, through Zend_Session_SaveHandler_DbTable.

Examples: Zend - Storing Session data in a database



来源:https://stackoverflow.com/questions/3760926/zend-auth-locked-session

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!