Session: Configured save path 'C:\Windows\Temp' is not writable by the PHP process
Asked Answered
G

5

6

An uncaught Exception was encountered

Type: Exception

Message: Session: Configured save path 'C:\Windows\Temp' is not writable by the PHP process.

Filename: prm\system\libraries\Session\drivers\Session_files_driver.php

Line Number: 125

Backtrace:

File: \prm\application\controllers\login.php Line: 8 Function: __construct

File: \prm\index.php Line: 279 Function: require_once

Not able to fix this issue. please suggest how to fix this

Growler answered 13/9, 2016 at 14:11 Comment(2)
add your code as wellTove
C:\Windows\Temp, give permission for writable... i mean in Windows unmark it from Read Only from folder property.Metabolize
G
15

We are setting up 'C:\Windows\Temp' windows directory path to database ci_session table.

change the following in your config file.

$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;

to

$config['sess_driver']= 'database';
$config['sess_cookie_name']= 'mycookie';
$config['sess_expiration']= 0;
$config['sess_save_path']= 'ci_session';
$config['sess_match_ip']= FALSE;
$config['sess_time_to_update']= 300;
$config['sess_regenerate_destroy']= FALSE;
$config['sess_use_database']= TRUE;
$config['sess_expire_on_close']= TRUE;
$config['sess_table_name']= 'ci_session';
Gonzalogoo answered 23/1, 2017 at 4:58 Comment(5)
I faced this issue in Windows server using Codeigniter Framework..The above solution Fixed it.Ddt
This solution helped me as wellEntellus
didn't he said he want to convert to database ?Punctual
I got three errors 1) ci_session doesn't exist 2) Message: session_write_close(): Cannot call session save handler in a recursive manner 3) Message: session_write_close(): Failed to write session data using user defined save handler. (session.save_path: /opt/lampp/temp/)Masculine
what are the columns in ci_session table?Goatfish
P
11

Edit config.php

Location: application/config/config.php

Before

$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;

After

$sessDir = session_save_path();
$sessDir = "{$sessDir}/sessionPath";
is_dir($sessDir)?:mkdir($sessDir);

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = $sessDir;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

It's work for me

Peipus answered 29/2, 2020 at 10:9 Comment(1)
@Sanjay Khatri it's my pleasurePeipus
T
1

In your application's config.php file search for $config['sess_save_path'] change its default value of sys_get_temp_dir() to another publicly accessible directory preferably not in the C: drive.

or you can set it globally in your php.ini file and call ini_get ('session.save_path'), but first make sure you have changed the default value of that option to a temp directory of your choice.

Taneka answered 24/10, 2016 at 9:41 Comment(1)
It was $config['sess_save_path'] = BASEPATH . 'cache/'; i changed to sys_get_temp_dir(); and it's working.Masculine
A
0

This error basically tells you that the PHP process does not have the permission to write to the cache directory specified in your config.

The simplest, clearest solution would be to grant write permission for the directory.

I don't use a windows machine so I can't tell you exactly how to do it, but you can look that up.

Aphorize answered 6/3, 2023 at 15:3 Comment(0)
P
0

I had this problem after I created a new CodeIgniter 4 project with Composer.

Normally sessions are saved in the folder specified in php.ini with setting session.save_path. You can check this by calling

phpinfo();

and look for

session.save_path

I was surprised to find out that the CodeIgniter tries to save the data in a different folder. It is configured in file app/Config/Paths.php. The variable to look for is

$writableDirectory

The (default) line of code is

public string $writableDirectory = __DIR__ . '/../../writable

I tried to remove the readonly flag from the folder, but that didn't work. Some process or application kept me from removing it. (I suspected Google Drive). Note: I am on Windows, but that doesn't really matter... I think.

Creating a new folder named "writable2" next to it and changing the setting to

public string $writableDirectory = __DIR__ . '/../../writable2

solved the problem.

Still don't know which process or application changed (and kept on changing) the folder to readonly. Changing the name back from writable2 to writable and the problem is back. Deleting folder writable and renaming folder writable2 to writable works though. Weird!

Palmira answered 8/6, 2023 at 13:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.