4

I am a new developer of CodeInger, last few month I had developed my project with PHP framework which is called CodeIgniter. So my problem was that when I tried to upgrade my project from version 2 to 3 I've found one concerning error which was about session.

Note: I am using Google Cloud Hosting.

Here is a message :

A PHP Error was encountered

Severity: Warning

Message: mkdir(): The local filesystem is readonly, mkdir failed

Filename: drivers/Session_files_driver.php

Line Number: 117

Backtrace:

File: /base/data/home/apps/s~chatomuk-staging/13.383916973498394810/index.php
Line: 292
Function: require_once

I have tries more than 3 hours to solve it but there was no answer.

could anyone tell me what is the problem ?

url : http://chatomuk-staging.appspot.com/

7
  • what have you tried in the three hours you've been trying to fix it? We don't want to give you suggestions you know don't work.
    – Wai Ha Lee
    Apr 28, 2015 at 6:37
  • 1
    $config['sess_save_path'] = NULL; Try to set this one.
    – Saty
    Apr 28, 2015 at 6:38
  • I have already do it but still not work :$config['sess_driver'] = 'files'; $config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_save_path'] = NULL; $config['sess_match_ip'] = FALSE; $config['sess_time_to_update'] = 300; $config['sess_regenerate_destroy'] = FALSE;
    – Samphors
    Apr 28, 2015 at 6:43
  • give 0755 permission to your ci folder
    – Saty
    Apr 28, 2015 at 6:47
  • $config['sess_driver'] = 'database'; $config['sess_save_path'] = 'ci_sessions'; add this into config.php file
    – Saty
    Apr 28, 2015 at 6:50

2 Answers 2

3

you need to set this two parameter in your config.php file

$config['sess_driver'] = 'database'; 
$config['sess_save_path'] = 'ci_sessions'; 
$config['sess_use_database'] = TRUE;

Before that you check you session table is exist or not in your database if not exist the create

CREATE TABLE IF NOT EXISTS ci_sessions ( session_id varchar(40) DEFAULT '0' NOT NULL, ip_address varchar(45) DEFAULT '0' NOT NULL, user_agent varchar(120) NOT NULL, last_activity int(10) unsigned DEFAULT 0 NOT NULL, user_data text NOT NULL, PRIMARY KEY (session_id), KEY last_activity_idx (last_activity) );
2

While this may of solved your problem it wasn't exactly the problem you are faced with in your error message.

It looks like in your config you set the session driver as a file based session driver. This means you need to set the path for your session. You also need to at the very least make sure the directory is writable by the user with permission running your php scripts usually www-data on linux boxes. Usually something like this.

sudo chmod g+w _ci_sessions

And if ownership isn't set properly something like this is probably safe.

sudo chown root:www-data _ci_sessions

You also should include a path for the driver like this.

$config['sess_save_path'] = APPPATH . '_ci_sessions';

Then make sure the directory has a path similar to this and is created. All your sessions will be stored here.

/var/www/html/application/_ci_sessions

I will add you only need to do this if you have the driver set to files like this.

$config['sess_driver'] = 'files';

Also make sure you use APPPATH environmental variable as absolute paths are required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.