0
votes

I developed a codeigniter application that sometimes throw an exception in session_start.

The returned code is:

A PHP Error was encountered

Severity: Notice

Message: session_start(): ps_files_cleanup_dir: opendir(/tmp) failed: Permission denied (13)

Filename: core/MY_Controller.php

Line Number: 2

In this line, I have just "session_start"

But this problem occurs occasionally.

Should I change the temp folder to another one inside CI folder?

Thanks.

2
You don't need to start session manualy if you use session library. Have you tried to load session library in constructor of MY_Controller.php or autoload it in autoload.php file? - Tpojka
Hi @Tpojka. Thanks for the response. I'm not using session library. I'm using plain php session control. But I think codeigniter is trying use apache temp folder. Maybe it should use some folder inside CI instead. What you think about it? - Márcio Gonzalez
Check if you have right permission on directory. Include some code if possible. Try with CI loading session because you will be able to use PHP syntax as well (if application uses CI version 3) and see if error persists. - Tpojka
OK @Tpojka. I will try and let you know. - Márcio Gonzalez

2 Answers

4
votes

You need to set session path in configuration settings

  • In application/config/config.php set

    $config['sess_save_path'] = FCPATH . 'application/cache/sessions/';

It works for me.

1
votes

If you use plesk just try:

$config['sess_save_path'] = sys_get_temp_dir();