I have a PHP application which has been developed with CakePHP 2.4.6 on Ubuntu Virtual Machine with PHP 5.3.10-1ubuntu3.11 installed on it (with Apache2). My problem is that I wanted to deploy it to the real server, which has PHP 5.4.16 and I get the following errors:
Warning (2): Illegal string offset 'session.cookie_lifetime' [CORE/Cake/Model/Datasource/CakeSession.php, line 482]
Warning (2): Illegal string offset 'session.name' [CORE/Cake/Model/Datasource/CakeSession.php, line 485]
Warning (2): Illegal string offset 'session.gc_maxlifetime' [CORE/Cake/Model/Datasource/CakeSession.php, line 491]
Warning (2): Illegal string offset 'session.cookie_httponly' [CORE/Cake/Model/Datasource/CakeSession.php, line 494]
Warning (2): Illegal string offset 'session.cookie_lifetime' [CORE/Cake/Model/Datasource/CakeSession.php, line 482]
Warning (2): Illegal string offset 'session.name' [CORE/Cake/Model/Datasource/CakeSession.php, line 485]
Warning (2): Illegal string offset 'session.gc_maxlifetime' [CORE/Cake/Model/Datasource/CakeSession.php, line 491]
Warning (2): Illegal string offset 'session.cookie_httponly' [CORE/Cake/Model/Datasource/CakeSession.php, line 494]
Warning (2): Illegal string offset 'session.cookie_lifetime' [CORE/Cake/Model/Datasource/CakeSession.php, line 482]
Warning (2): Illegal string offset 'session.name' [CORE/Cake/Model/Datasource/CakeSession.php, line 485]
Warning (2): Illegal string offset 'session.gc_maxlifetime' [CORE/Cake/Model/Datasource/CakeSession.php, line 491]
Warning (2): Illegal string offset 'session.cookie_httponly' [CORE/Cake/Model/Datasource/CakeSession.php, line 494]
Warning (2): Illegal string offset 'session.cookie_lifetime' [CORE/Cake/Model/Datasource/CakeSession.php, line 482]
Warning (2): Illegal string offset 'session.name' [CORE/Cake/Model/Datasource/CakeSession.php, line 485]
Warning (2): Illegal string offset 'session.gc_maxlifetime' [CORE/Cake/Model/Datasource/CakeSession.php, line 491]
Warning (2): Illegal string offset 'session.cookie_httponly' [CORE/Cake/Model/Datasource/CakeSession.php, line 494]
I have read about this error, that (if I'm not mistaken) it means you want to use a string as an array, but it has something with the CakePHP's core and not with my PHP application.
It gives these errors (warnings) to all of my pages, and the content is not loaded, so I really only see these messages without any css or html layout.
It was running properly on my virtual machine, so I can just assume that it has to do something with the newer version of PHP installed on the server.
I have also tried to use a newer version of CakePHP, version 2.5.1, but it has also resulted in these kind of errors.
Update 1: Here is the relevant PHP code snippet from the CakeSession.php file:
if (!isset($sessionConfig['ini']['session.cookie_lifetime'])) {
$sessionConfig['ini']['session.cookie_lifetime'] = $sessionConfig['cookieTimeout'] * 60;
}
if (!isset($sessionConfig['ini']['session.name'])) {
$sessionConfig['ini']['session.name'] = $sessionConfig['cookie'];
}
And these are the variables, the DebugKit shows:
$sessionConfig = array(
'cookie' => 'CAKEPHP',
'timeout' => '240',
'ini' => 'C / 14400 CAKEPHP 14400 1',
'defaults' => 'php',
'cookieTimeout' => '240'
)
$defaults = array(
'cookie' => 'CAKEPHP',
'timeout' => (int) 240,
'ini' => array(
'session.use_trans_sid' => (int) 0,
'session.cookie_path' => '/'
)
)
Update 2: I have tried to put a clean CakePHP from Git (with the app folder also) and it works. So it seems to be there are some problems with my application... But where should I look?
Any suggestions? Thanks in advance.