Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

session_start() is not success when use multi byte into the session in cakephp3

Recently I started to use cakephp3.1 and I get the error that bellow.

Warning (2): session_start(): Trying to destroy uninitialized session [CORE/src/Network/Session.php, line 324]

Warning (2): session_start() [function.session-start]: Failed to decode session object. Session has been destroyed [CORE/src/Network/Session.php, line 324]

Warning (2): session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/www/service/vendor/cakephp/cakephp/src/Error/Debugger.php:742) [CORE/src/Network/Session.php, line 324]

When I set multi byte word into the session such as login user's name is Japanese or something multi byte word set to flash, it's happen.

So I assumed I did't installed mbstring extension. However there's already installed.

like image 653
user1544853 Avatar asked Nov 09 '22 03:11

user1544853


1 Answers

This generally happens due to the session storage not being able to handle multibyte characters. If the storage is a mysql database then setting the

Character Set to utf8

Collation to utf8_general_ci

for the table and the field holding the session data solves these problems.

like image 59
Cemal Avatar answered Nov 14 '22 22:11

Cemal