0
votes

When I try to write anything to the session, I get the error Call to a member function write on null(). I have checked my config.php and the directory that the cache is stored in (/cake/app/temp) is writable. I changed it to the PHP setting (Write the cache to /tmp) and that doesn't work either.

I can write to the $_SESSION variable in standard PHP but CakePHP seems to be unable to do this, and I am at a loss as to why.

I followed the steps here but they also did not work: CakePHP 2.1 $this->Session->write is not working

1

1 Answers

1
votes

I presume you made sure that you use the file cache.

Please check if /cake/app/tmp/cache and alle subdirectories are writeable by the user and the group under which your server is running.

If you are on a dev environment also try setting the rights in the cache folder to 777.

Add to your bootstrap file the following code:

Cache::config(
    'default', array(
        'engine'   => 'File',
        'duration' => '+1 hours',
    )
);

Hope that helps.