(phpmyadmin) 如何为远程服务器更改 $cfg['Servers'][$i]['host']?
(phpmyadmin) how do I change $cfg['Servers'][$i]['host'] for remote server?
我认为 phpmyadmin index.php
在执行时被调用 config.inc.php
。
所以我尝试了 config.inc.php
/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = $_GET['test']; // I changed here
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
然后像这样调用 url。
http://localhost/index.php?test=211.212.14.11
但我遇到了显示主机错误并且无法正常工作。
我该怎么办?
这里不使用 GET,它由 phpMyAdmin 清理,正确的语法是将 IP 地址或主机名直接放入指令中,例如 $cfg['Servers'][$i]['host'] = '192.168.5.6';
或 $cfg['Servers'][$i]['host'] = 'db.example.com';
如果您希望能够在登录时定义任意主机,请查看 $cfg['AllowArbitraryServer']
指令(当设置为 true 时,您可以在登录页面上输入任何服务器)。
我认为 phpmyadmin index.php
在执行时被调用 config.inc.php
。
所以我尝试了 config.inc.php
/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = $_GET['test']; // I changed here
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
然后像这样调用 url。
http://localhost/index.php?test=211.212.14.11
但我遇到了显示主机错误并且无法正常工作。 我该怎么办?
这里不使用 GET,它由 phpMyAdmin 清理,正确的语法是将 IP 地址或主机名直接放入指令中,例如 $cfg['Servers'][$i]['host'] = '192.168.5.6';
或 $cfg['Servers'][$i]['host'] = 'db.example.com';
如果您希望能够在登录时定义任意主机,请查看 $cfg['AllowArbitraryServer']
指令(当设置为 true 时,您可以在登录页面上输入任何服务器)。