3

Fedora 25 + PHP 7 + Apache 2.4.23

Hello, after I change session.save_path in php.ini and restart apache, I can successfully verify that it's modified with:

$ php -i | grep session.save_path

However, in the html/php pages themselves, the sessions are not written so the session.save_path I set, but they're stubbornly written to /var/lib/php/session/. Even setting the value in .htaccess isn't working:

php_value session.save_path "/mycustom/path/folder"

The only working solution that can override the default /var/lib/php/session/ is to set the value in the php file itself:

ini_set('session.save_path','/mycustom/path/folder');

Any ideas?

synkro
  • 223
  • 1
  • 2
  • 8

1 Answers1

3
  1. create phpinfo() file in dir with this php file.
  2. open it via browser, and find list of applied ini-files.
  3. check all of these files to contain session.save_path override
dr-evil
  • 377
  • 1
  • 5
  • 1
    Ah, that trick opened my eye on a little detail. In fact, phpinfo() was indeed showing that session.save_path had a local value of `/var/lib/php/session` and a master value of `/var/www/html/session` (my override in php.ini). I read that local values override master values http://stackoverflow.com/questions/19520744/what-is-the-difference-between-local-value-and-master-value, so I checked all the php.d files and none had any overrides. BUT, running a `grep -R "session.save_path" /etc/httpd` and bingo, the override was coming from `/etc/httpd/conf.d/php.conf`. – synkro Dec 14 '16 at 18:59
  • 1
    Looks like the server I was working on runs `php-fpm` which is a separate service running php and needs to be restarted (or reloaded) for ini changes to take effect in apache. – gillytech Feb 07 '20 at 00:49