php phpmyadmin 自动注销时间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11272973/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
phpmyadmin automatic logout time
提问by Abadis
How can I change the phpmyadmin automatic log out time?
如何更改 phpmyadmin 自动注销时间?
It will log out automatically after 1440 seconds which is very low for me. How can I change the option or remove log in request completely?
它会在 1440 秒后自动注销,这对我来说非常低。如何更改选项或完全删除登录请求?
采纳答案by Ravinder Singh
Create or edit your php.inifile and set this variable value in it:
创建或编辑您的php.ini文件并在其中设置此变量值:
session.gc_maxlifetime = 1440
session.gc_maxlifetime = 1440
The integer is in seconds. 500000 seconds is 5.7 days. Then restart apache.
整数以秒为单位。500000 秒是 5.7 天。然后重启apache。
回答by laurent
Changing php.ini will change the session duration for all the websites running on the server. To change it just for PhpMyAdmin, open config.inc.phpand add:
更改 php.ini 将更改服务器上运行的所有网站的会话持续时间。要仅为 PhpMyAdmin 更改它,请打开config.inc.php并添加:
$sessionDuration = 60*60*24*7; // 60*60*24*7 = one week
ini_set('session.gc_maxlifetime', $sessionDuration);
$cfg['LoginCookieValidity'] = $sessionDuration;
回答by Kohjah Breese
In PHPMyAdmin 4 this no longer appears in the config.inc.php file. Instead go to PHPMyAdmin in your browser. Ensure you are at the localhost level to see the Settings link. Then set Settings > Features > Change the value of 'Login cookie validity' > Save
在 PHPMyAdmin 4 中,它不再出现在 config.inc.php 文件中。而是在浏览器中转到 PHPMyAdmin。确保您处于 localhost 级别以查看设置链接。然后设置设置>功能>更改“登录cookie有效性”的值>保存


回答by Foreever
You can change the cookie time session feature at phpmyadmin web interface
您可以在 phpmyadmin Web 界面更改 cookie 时间会话功能
Settings->Features->General->Login cookie validity
OR
或者
If you want to change the 'login cookie validity' in configuration file, then open the phpmMyAdmin configuration file, config.inc.phpin the root directory of PHPMyAdmin.(root directory is usually /etc/phpmyadmin/)
如果要更改配置文件中的“登录cookie有效性”,则打开phpmMyAdmin配置文件,config.inc.php在PHPMyAdmin的根目录下。(根目录通常是/etc/phpmyadmin/)
After locating the config.inc.php , search for the line below and set it to the value of seconds you want phpmyadmin to timeout:
找到 config.inc.php 后,搜索下面的行并将其设置为您希望 phpmyadmin 超时的秒数:
['LoginCookieValidity']
If you couldn't find the above line, just add the following:
如果找不到上面的行,只需添加以下内容:
$cfg['Servers'][$i]['LoginCookieValidity'] = <your_new_timeout>;
For example:
例如:
$cfg['Servers'][$i]['LoginCookieValidity'] = 3600 * 3;
The Timeout is set to 3 Hours from the Example above.
上例中的超时设置为 3 小时。
session.gc_maxlifetimemight limit session validity and if the session is lost, the login cookie is also invalidated. So, we may need to set the session.gc_maxlifetime in php.iniconfiguration file(file location is /etc/php5 /apache2/php.ini in ubuntu).
session.gc_maxlifetime可能会限制会话有效性,如果会话丢失,登录 cookie 也会失效。因此,我们可能需要在php.ini配置文件中设置 session.gc_maxlifetime (文件位置在 ubuntu 中为 /etc/php5 /apache2/php.ini)。
session.gc_maxlifetime = 3600 * 3
phpMyAdmin Documentation on LoginCookieValidity关于 LoginCookieValidity 的 phpMyAdmin 文档
$cfg['LoginCookieValidity']
$cfg['LoginCookieValidity']
Type: integer [number of seconds]
Default value: 1440
类型: 整数 [秒数]
默认值: 1440
Define how long a login cookie is valid. Please note that php configuration option session.gc_maxlifetime might limit session validity and if the session is lost, the login cookie is also invalidated. So it is a good idea to set session.gc_maxlifetime at least to the same value of $cfg['LoginCookieValidity'].
定义登录 cookie 的有效期。请注意,php 配置选项 session.gc_maxlifetime 可能会限制会话有效性,如果会话丢失,登录 cookie 也会失效。因此,最好将 session.gc_maxlifetime 设置为至少与 $cfg['LoginCookieValidity'] 相同的值。
NOTE:
笔记:
- If your server crashed and cannot load your phpmyadmin page, check
your apache log at /var/log/apache2/error.log. If you got
PHP Fatal error: Call to a member function get() on a non-object in /path/to/phpmyadmin/libraries/Header.class.phpon line 135, then do achmod 644 config.inc.php. that should take care of the error. - If you get the warning:
Your PHP parameter session.gc_maxlifetime is lower that cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin., then change thesession.gc_maxlifetimeas mentioned above.
- 如果您的服务器崩溃并且无法加载您的 phpmyadmin 页面,请在 /var/log/apache2/error.log 检查您的 apache 日志。如果你
PHP Fatal error: Call to a member function get() on a non-object in /path/to/phpmyadmin/libraries/Header.class.php在第 135 行,那么做一个chmod 644 config.inc.php. 这应该处理错误。 - 如果您收到警告:
Your PHP parameter session.gc_maxlifetime is lower that cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.,请session.gc_maxlifetime按上述方式更改。
回答by Chris
For LOCAL installs only, you can remove the login and timeout altogether - this seems to be what you're after. By changing the authorization type to "config" and entering your database username and password in your config file you are automatically logged in. Add to config.inc.php:
仅对于 LOCAL 安装,您可以完全删除登录和超时 - 这似乎是您所追求的。通过将授权类型更改为“config”并在配置文件中输入您的数据库用户名和密码,您将自动登录。添加到config.inc.php:
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'username';
$cfg['Servers'][$i]['password'] = 'password';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
Of-course if you do this on a server on the internet, some cheeky chappy will come along and gleefully download all your passwords and delete your website. This is for a development server running on your own laptop only.
当然,如果您在 Internet 上的服务器上执行此操作,一些厚颜无耻的家伙会兴高采烈地下载您的所有密码并删除您的网站。这仅适用于在您自己的笔记本电脑上运行的开发服务器。
An easier way to customise phpmyadmin these days is to go to http://www.example.com/phpmyadmin/setup/, save all your settings section at a time, click save or download at the bottom, copy the file generated to your root phpmyadmin directory, then chmod it. You have to turn off write permission even if it is a local server as phpmyadmin checks this before it lets yo log in.
现在自定义 phpmyadmin 的一种更简单的方法是访问http://www.example.com/phpmyadmin/setup/,一次保存所有设置部分,单击底部的保存或下载,将生成的文件复制到您的root phpmyadmin 目录,然后 chmod 它。即使它是本地服务器,您也必须关闭写权限,因为 phpmyadmin 在允许您登录之前会检查这一点。
回答by Koushik Chowdhury
Explore directory 'apps\phpmyadmin4.5.2' in your wamp folder and open config.inc.php file. Then add this line under existing code.
探索 wamp 文件夹中的目录“apps\phpmyadmin4.5.2”并打开 config.inc.php 文件。然后在现有代码下添加这一行。
'$cfg['LoginCookieValidity'] = 3600 * 10; //login cookie validity extended upto 10 hours'.
That's all...
就这样...
回答by Pmpr
Server:localhost -> Settings -> Features -> General -> Login cookie validity
Server:localhost -> Settings -> Features -> General -> Login cookie validity
回答by Denis Viunyk
I have phpmyadmin 4.9.2. and try to config LoginCookieValidity, but I have auto logout :( If you using localhost you can try https://docs.phpmyadmin.net/en/latest/config.html#example-for-ip-address-limited-autologin
我有 phpmyadmin 4.9.2。并尝试配置 LoginCookieValidity,但我有自动注销 :( 如果您使用本地主机,您可以尝试https://docs.phpmyadmin.net/en/latest/config.html#example-for-ip-address-limited-autologin
if ($_SERVER["REMOTE_ADDR"] == "127.0.0.1") {
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'yourpassword';
} else {
$cfg['Servers'][$i]['auth_type'] = 'cookie';
}

