There is a php deserializer for Lua in Github.
https://github.com/agladysh/lua-phpserializeBut I would recommend using another serializer for sessions though , maybe MessagePack if it is available.
I think the problem with sessions is locking.
Regards,
Bertrand Mansion
Mamasam
If you identify the session by the cookie and user agent, I think you don't need to share the session value between ngx_lua and PHP, you can store the ngx_lua session and PHP session separately, you only need to check the session according to the cookie if you pass the cookie correctly.
在 2014年4月17日星期四UTC+8下午4时35分59秒,Jerome Lafon写道:
Hello,
I would like to share the development of a website between PHP, mostly for the huge choice of frameworks and template engines, and Lua for some parts of the website especially for performance and managing a lot of websockets opened at the same time.
For doing that I need to retrieve some PHP session variables in Lua in order to check for example the userId and some other information.
So I have configured PHP with PHPREDIS to store PHP sessions in REDIS.
In Lua I can access the sessions in REDIS using the phpsessid retrieved by the cookie as the REDIS key.
My question: Is there a PHP session data to Lua parser or should I develop it from scratch?
Jérôme
.