I installed Laravel 4.0 and got this error
ErrorException SessionHandler::read(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' return (bool) $this->handler->close(); } /** * {@inheritdoc} / public function read($id) { return (string) $this->handler->read($id); } /*
Do you have Laravel 3 installed on the same machine? By default, Laravel 4 uses the same session cookie name (as Laravel 3), now found in /app/config/session.php file. Simply change:
'cookie' => 'laravel_session',
to, e.g.
'cookie' => 'laravel_session_4',
and refresh browser. All should work now.
It could be that you have a corrupt cookie. Try clearing cookies in your browser.
Take a look at this discussion: https://stackoverflow.com/a/16318456/1563189
Especially:
How do you end up with illegal characters in PHPSESSID in the first place? Aren't they generated by PHP automatically? –
Lèse majesté
Jul 6 '10 at 11:57They are, but a cookie that links you to a generated session id is client side. If that cookie changes to an invalid format (somebody is trying to exploit something) PHP will notice it. –
Aleksey Korzun
Sep 6 '11 at 19:56
There is a bug report for this problem (https://bugs.php.net/bug.php?id=68063)
You can check the success of your session_start and generate the id if needed:
$ok = @session_start();
if(!$ok){
session_regenerate_id(true); // replace the Session ID
session_start();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With