0

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.

Márcio Gonzalez
  • 1,020
  • 1
  • 8
  • 20
  • 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 Aug 24 '15 at 20:43
  • 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 Aug 24 '15 at 20:48
  • 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 Aug 24 '15 at 20:51
  • OK @Tpojka. I will try and let you know. – Márcio Gonzalez Aug 24 '15 at 21:01

2 Answers2

4

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.

Ramesh Kumar
  • 542
  • 2
  • 10
  • 19
1

If you use plesk just try:

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

xargr
  • 2,788
  • 1
  • 19
  • 28