2

One of my Debian machine's inodes recently filled, and the culprit turned out to be /var/lib/php5/sessions, which had accumulated 2.5 million temporary session files, though it's supposed to be cleaned up whenever files are more than 24 minutes old.

Debian steps on PHP's native garbage collection, and instead uses a program called /usr/lib/php5/sessionclean to do this work. My version is dated Feb 8, which should be the newest version on Debian Jessie. It was exiting quietly, but as far as I can tell, doing nothing.

I was looking through the code and found this line: session_config=$(PHP_INI_SCAN_DIR=/etc/php5/${conf_dir}/conf.d/ php5 -c /etc/php5/${conf_dir}/php.ini -d "error_reporting='~E_ALL'" -r 'foreach(ini_get_all("session") as $k => $v) echo "$k=".$v["local_value"]."\n";') That seems to be consistent across multiple machines all running the newest Jessie.

As far as I can tell that doesn't work and would never work because it tries to run /etc/php5/apache2/conf.d/ php5 instead of /etc/php5/apache2/conf.d/php5. But even putting that back together, I kept getting errors, this time about the '-c' option.

Any ideas about how to make this work right and why the out-of-the-box debian is failing?

Shannon A.
  • 173
  • 9
  • In case this turns out to be a bug, please report it in the Debian BTS, in case it's not present there yet, to get this fixed globally. – gxx Jul 15 '17 at 00:58

1 Answers1

0

The space in /etc/php5/apache2/conf.d/ php5 is correct (the php5 binary is not inside the configuration dir!).

In my case I had some no longer supported config lines in my php.ini, which causes that the sessionclean script can not read the php.ini.

Check your configuration with this command.

php -e -c /etc/php5/apache2/php.ini -d display_errors=on -r 'echo "OK\n";';

I got the following warning

Fatal error: Directive 'magic_quotes_gpc' is no longer available in PHP in Unknown on line 0

Remove those invalid values from your config and now the sessionclean script can read your config file.