我在理解如何在我的网站上设置 php.ini 文件时遇到了一些麻烦。我已经包括了这条线session.cookie_lifetime = 1800
以及其他一些线,但没有任何改变。当我转到我的 phpinfo.php pgae 时,我在 .ini 文件中配置的所有设置都没有生效。谁能帮我这个?谢谢。
2 回答
When you make changes in the php.ini
file you have to restart the webserver or reloading the configuration files in most cases.
Because I have not enough reputation yet to write comments I assume you are using a LAMP environment. You can restart the webserver by typing in console:
service apache2 restart
or
/etc/init.d/apache2 restart
reload
or force-reload
instead of restart
should also work for just reloading the configuration files, but with restart
you're one the safe side.
Also make sure you're editing the correct php.ini
file. You can find the right file by looking at the 'Loaded Configuration File' directive of phpinfo()
output.
在文件中添加以下行.htaccess
,它将超时增加到 30 分钟。
php_value session.cookie_lifetime 1800
php_value session.gc_maxlifetime 1800