0

I use

  • Centos 7 (latest update)
  • Apache 2.4.6
  • PHP 7.2

I would like to change the directory where sessions stored on the server, the default directory is /var/lib/php/session/, I can use this directory without any problem, but when I change the directory in PHP.ini file, I get an error :

session_start(): open(/var/www/session/sess_dug784eu96aj06eh1gte4hak2f, O_RDWR) failed: Permission denied (13)

I also edited php.conf inside /etc/httpd/conf.d and removed this line To stop session directory from being overridden :

php_value session.save_path    "/var/lib/php/session"

As you can see, I use /var/www/session/ as new directory to store sessions and this directory exist and have exactly same Permission as default directory :

0770 / owner : root / group : Apache

I also tried to copy the existing session file from default directory to the new directory, but I still get same error !

Thank you for your help.

Sinf
  • 43
  • 1
  • 7

1 Answers1

0

Okay I found the solution, THX @womble to point where the problem is, I could at least search on the correct way,

In case if someone else have same problem, SELinux most be Disabled (which is not recommended), or it most be configured to allow Apache access the new directory :

chcon -t httpd_sys_rw_content_t /var/www/session -R
Sinf
  • 43
  • 1
  • 7