php - Zend Auth locked session


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?


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).




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…


Option 2

The Zend way, through Zend_Session_SaveHandler_DbTable.

Examples: Zend - Storing Session data in a database

People are also looking for solutions to the problem: php - Sum total products kcal , Protein and other attributes Woocommerce


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.