waterloo3122 / open-source-docs

Apache License 2.0
0 stars 0 forks source link

php5.6 change default session location php5修改默认的session缓存文件位置 #86

Open waterloo3122 opened 5 years ago

waterloo3122 commented 5 years ago

check this article

https://serverfault.com/questions/890897/php-sessions-directory-keeps-filling-until-overflowing

默认的php配置在运行phpmyadmin的时候,会在/tmp目录下,建立大量的sess_开头的文件, 导致/tmp目录在执行ls的命令时响应很慢。

waterloo3122 commented 5 years ago

mkdir /tmp/phpsession

vim /usr/local/php/etc/php.ini 找到下面这行,并记住5这个数字 session.hash_bits_per_character = 5

将这一行对应的内容改为 session.save_path = "2;/tmp/phpsession/"

wget https://raw.githubusercontent.com/php/php-src/master/ext/session/mod_files.sh bash mod_files.sh /tmp/phpsession 2 5

chown -R bae.bae /tmp/phpsession

/etc/init.d/php-fpm restart