Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP Error: Unable to configure the session, setting session.auto_start failed

Tags:

I'm getting this error:

Error: [CakeSessionException] Unable to configure the session, setting session.auto_start failed.

I'm using Cakephp 2.2.4.

EDIT

It seems this guy had the same issue: Cakephp Session error on live site and using this

if(!isset($_SESSION)) session_start(); 

inside beforefilter method of AppController fix the error.

So my question is: why this happened? Everything was working fine and then suddendly this error appeared. Additionally I've realized that the folder app/tmp/sessions is empty and I have configured the session to be handled by Cake (in Config/core.php).

like image 301
Marcos Avatar asked Sep 25 '13 12:09

Marcos


2 Answers

Andriy Struk's answer is correct. He said: So you have 3 main options: upgrade CakePHP, downgrade PHP, or use standard PHP sessions.

But there's a 4th option, you can simply comment out a single line in /lib/Cake/Model/Datasource/CakeSession.php (around line 557):

// 'session.auto_start' => 0,

That stops Cake calling ini_set() on that setting, and prevents the fatal error.

like image 156
Simon East Avatar answered Oct 09 '22 04:10

Simon East


In PHP version 5.4.19 - developers closed the ability to set session.auto_start option from user script.

CakePHP removed this option from default session configuration only in 2.4.0 version.

So you have 3 main option: upgrade CakePHP, downgrade PHP, or use standard php session.

like image 23
Andriy Struk Avatar answered Oct 09 '22 04:10

Andriy Struk