php phpMyAdmin 配置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4361416/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 12:49:05  来源:igfitidea点击:

phpMyAdmin configuration

phpphpmyadmin

提问by Caner

  • How do I increase phpmyadmin session timeout?
  • How do I increase phpmyadmin import file size limit(currently it says Max: 2,048KiB). I tried changing upload_max_filesizein php.inibut it didn't make any difference.
  • 如何增加 phpmyadmin 会话超时?
  • 如何增加 phpmyadmin 导入文件大小限制(目前显示最大:2,048KiB)。我试过换衣服upload_max_filesizephp.ini但没有任何区别。

回答by Poelinca Dorin

config.inc.php > $cfg['LoginCookieValidity'] = 3600 * 9; // 9 hours

config.inc.php > $cfg['LoginCookieValidity'] = 3600 * 9; // 9 hours

edit from the link posted by ajreal: LoginCookieValidity

从 ajreal 发布的链接中编辑:LoginCookieValidity

for the second question , after changing upload_max_filesize in php.ini did you restart apache ( or whatever webserver you use ) ?

对于第二个问题,在 php.ini 中更改 upload_max_filesize 后,您是否重新启动了 apache(或您使用的任何网络服务器)?

回答by Eric Leschinski

How to set phpMyAdmin default 1440 second timeout higher:

如何将 phpMyAdmin 默认 1440 秒超时设置得更高:

  1. locate php.ini

    el@apollo:/var/lib/phpmyadmin$ locate php.ini
    /etc/php5/apache2/php.ini
    
  2. open the file as root to edit, find this line:

    session.gc_maxlifetime = 1440
    
  3. Change it to this (500000 seconds is 5.7 days)

    session.gc_maxlifetime = 500000
    
  4. Restart apache.

  1. 找到 php.ini

    el@apollo:/var/lib/phpmyadmin$ locate php.ini
    /etc/php5/apache2/php.ini
    
  2. 以 root 身份打开文件进行编辑,找到这一行:

    session.gc_maxlifetime = 1440
    
  3. 改成这样(500000秒是5.7天)

    session.gc_maxlifetime = 500000
    
  4. 重启阿帕奇。

Doing this decreases security because then it increases opportunity for cross site scripting and man in the middle attacks. It's all fun and games until you find your server is part of a botnet farming for credit cards.

这样做会降低安全性,因为这会增加跨站点脚本和中间人攻击的机会。在您发现您的服务器是信用卡僵尸网络养殖的一部分之前,这一切都很有趣和游戏。

回答by Eduardo Cuomo

  1. Edit phpMyAdmin's config.inc.phpand add or update LoginCookieValiditythe value as follows:

    $cfg['LoginCookieValidity'] = 3600 * 9; // 9 hours
    
  2. To upload more than 2M:

    cd /etc/php5/apache2/php.ini
    
    sudo nano php.ini
    
  3. Search for upload_max_filesizein php.ini, and change value to 64M(for 64 Mb):

    upload_max_filesize = 64M
    
  4. Save and exit.

  5. Restart apache:

    sudo /etc/init.d/apache2 restart
    
  6. Finish!

  1. 编辑 phpMyAdminconfig.inc.php并添加或更新LoginCookieValidity值,如下所示:

    $cfg['LoginCookieValidity'] = 3600 * 9; // 9 hours
    
  2. 上传超过2M:

    cd /etc/php5/apache2/php.ini
    
    sudo nano php.ini
    
  3. 搜索upload_max_filesizein php.ini,并将值更改为64M(对于 64 Mb):

    upload_max_filesize = 64M
    
  4. 保存并退出。

  5. 重新启动apache

    sudo /etc/init.d/apache2 restart
    
  6. 结束!

回答by dinhokz

For the first question, you need to change the $cfg[‘LoginCookieValidity']config in the config.inc.php. Open config.inc.php in the phpMyAdmin “root” directory. Look for a line that contains this: $cfg[‘LoginCookieValidity']. Set the value to the desired amount of seconds. If the line doesn't exist, just add it like this:

对于第一个问题,您需要更改$cfg[‘LoginCookieValidity']config.inc.php 中的配置。打开 phpMyAdmin “根”目录中的 config.inc.php。查找包含以下内容的行:$cfg['LoginCookieValidity']。将该值设置为所需的秒数。如果该行不存在,只需像这样添加它:

$cfg[‘LoginCookieValidity'] = 3600; //(3600 = one hour)

You will need to login again to phpmyadmin.

您将需要再次登录到 phpmyadmin。

This also assumes that the PHP session garbage collection is set-up accordingly. This can be done in a number of ways:

这也假设 PHP 会话垃圾收集已相应设置。这可以通过多种方式完成:

  • php.ini; add a line (or change an existing) that contains session.gc_maxlifetime = <seconds>
  • Apache configuration; add a line to the appropriate block that says php_admin_value session.gc_maxlifetime <seconds>
  • config.inc.php (phpMyAdmin); after the previously edited line, add a line with ini_set(‘session.gc_maxlifetime', <seconds>);
  • php.ini; 添加一行(或更改现有的)包含session.gc_maxlifetime = <seconds>
  • 阿帕奇配置;在适当的块中添加一行,上面写着php_admin_value session.gc_maxlifetime <seconds>
  • config.inc.php (phpMyAdmin); 在先前编辑的行之后,添加一行ini_set(‘session.gc_maxlifetime', <seconds>);

About the second question:

关于第二个问题:

You need to change both, upload_max_filesizeand post_max_sizein your php.ini. The post_max_sizevalue needs to be at least the upload_max_filesizevalue.

您需要更改两者,upload_max_filesizepost_max_size在您的 php.ini 中更改。该post_max_size值必须至少upload_max_filesize值。

Don't forget to restart your server

不要忘记重新启动服务器

Reference

参考

回答by ReverseEMF

Rather than setting session.gc_maxlifetimein the php.inifile, better to add the following to your config.inc.phpfile (typically in the /etc/phpmyadmindirectory):

与其在php.ini文件中设置session.gc_maxlifetime,不如将以下内容添加到config.inc.php文件中(通常在/etc/phpmyadmin目录中):

ini_set('session.gc_maxlifetime', '86400');

That way you don't compromise security for other PHP scripts, or cause excessive clutter in the RAM due to infrequent Garbage Collection.

这样您就不会损害其他 PHP 脚本的安全性,也不会由于不频繁的垃圾收集而导致 RAM 中的过度混乱。

回答by MrFreak

Try by changing post_max_sizein /etc/php.inifile.

通过改变尝试post_max_size/etc/php.ini文件中。

回答by Jekis

If you wished to keep phpMyAdmin from timing out so often, you might add this line:

$cfg['LoginCookieValidity'] = 86400;

By default, phpMyAdmin times out every 1440 seconds; to change this, change the session.gc_maxlifetime in php.ini as follows:

session.gc_maxlifetime = 86400

如果您希望避免 phpMyAdmin 经常超时,您可以添加以下行:

$cfg['LoginCookieValidity'] = 86400;

默认情况下,phpMyAdmin 每 1440 秒超时一次;要更改此设置,请按如下方式更改 php.ini 中的 session.gc_maxlifetime:

session.gc_maxlifetime = 86400

https://wiki.phpmyadmin.net/pma/phpMyAdmin_configuration_file

https://wiki.phpmyadmin.net/pma/phpMyAdmin_configuration_file

回答by mohamad

Edit phpMyAdmin's config.inc.phpand add or update LoginCookieValiditythe value as follows:

编辑 phpMyAdminconfig.inc.php并添加或更新LoginCookieValidity值,如下所示:

$cfg['LoginCookieValidity'] = 3600 * 9; // 9 hours

In wamp or xampp or anything you use at php.ini, Search for upload_max_filesizethis is where you should change it,

在 wamp 或 xampp 或您使用的任何东西中php.ini,搜索upload_max_filesize这里是您应该更改它的地方,

we suggest you not use more than 64M filesize cause sometimes it makes crash:

我们建议您不要使用超过 64M 的文件大小,因为有时它会导致崩溃:

upload_max_filesize = 64M

Save and exit.

保存并退出。

回答by DaniB

I'm aware this post has been answered, but I've just resolved the same issue, so I thought I would add my findings to help others.

我知道这篇文章已经得到回答,但我刚刚解决了同样的问题,所以我想我会添加我的发现来帮助其他人。

I needed to increase the PhpMyAdmin upload file size limit from default the 2,048KiB and I too changed the upload_max_filesize and post_max_size and memory_limit, but nothing changed.

我需要将 PhpMyAdmin 上传文件大小限制从默认值 2,048KiB 增加,我也更改了 upload_max_filesize 和 post_max_size 和 memory_limit,但没有任何改变。

It took my a while to find the problem, when I used the phpinfo(); script to identify where the PHP.ini file was it said was here: C:\Program Files (x86)\iis express\PHP\v5.5\php.ini, but I finally noticed in the PhpMyAdmin homepage that the Web server was running version: 5.6.31. So, I updated the upload, post and memory limits in the PHP.ini for both versions 5.5 and 5.6 and the import limit in PhpMyAdmin increased.

当我使用 phpinfo(); 时,我花了一段时间才发现问题。脚本来识别它所说的 PHP.ini 文件在哪里:C:\Program Files (x86)\iis express\PHP\v5.5\php.ini,但我终于在 PhpMyAdmin 主页中注意到 Web 服务器在运行版本:5.6.31。因此,我更新了 5.5 和 5.6 版本的 PHP.ini 中的上传、发布和内存限制,并增加了 PhpMyAdmin 中的导入限制。

回答by Fluxine

I add to Poelinca's answer that the mechanism of this limit can be found in the PMA sources under libraries/Config.class.php,

我在 Poelinca 的回答中补充说,可以在 PMA 来源下找到此限制的机制libraries/Config.class.php

function checkUploadSize()

function checkUploadSize()

It will use upload_max_filesizeif defined or 5M else and if max_upload_sizeis also defined it will get the min of the two.

它将使用upload_max_filesizeif 已定义或 5M else 并且如果max_upload_size也已定义,它将获得两者的最小值。

(PMA version 3.3.7deb7)

(PMA 版本 3.3.7deb7)