0

In order to access to a remote database I have edited config.inc.php and at the end of it, before the end ?> I have added :

$i++;
$cfg['Servers'][$i]['host'] = 'HostName:port'; //provide hostname and port if other than default
$cfg['Servers'][$i]['user'] = 'userName';      //user name for your remote server
$cfg['Servers'][$i]['password'] = 'Password';  //password
$cfg['Servers'][$i]['auth_type'] = 'config';   // keep it as config

but when I connect using browser I have this error message:

Notice in ./libraries/common.inc.php#1204 Undefined variable: i

Backtrace

./phpmyadmin.css.php#14: require_once(./libraries/common.inc.php)

The versions are:

PHP 5.4.16 Development Server
phpMyAdmin 4.4.15.10
MySQL 5.6.32 - MySQL Community Server (GPL)

phpMyAdmin works well with local database, without configure common.inc.php

In the middle of common.inc.php there's this instruction unset($i), but how can I use the i variable a the end of common.inc.php if it is no longer available ?

I have initialized i in this way

$i=2;

now I see a drop down menu with server name, but when I selected one of them it returns to localhost.

Using mysql command to connect to the remote database server and using the same user/password, I can successfully connect to the database server.

On client server I'm using Linux, on remote I'm using Windows 7

I have entered another request regarding the server selection problem only at phpMyAdmin can't connect to remote sever on Windows 7 from Linux client

famedoro
  • 1,223
  • 2
  • 17
  • 41
  • i think you miss a line like $i = 0; – A. Blub Jul 06 '17 at 08:52
  • _“but how can I use the i variable a the end of common.inc.php if it is no longer available ?”_ – _why_ do you want to “use it at the end”? If this gets unset deliberately, then there’s probably a reason for that. What keeps you from adding to the server configuration in the place of the config file where that originally happens? – CBroe Jul 06 '17 at 09:34

1 Answers1

0

It's a Notice that occurs when you access a variable that is not defined. In your case the variable is $i.

Define is first as below

$i = 0;

Then use it in rest of your code.

Samir Selia
  • 7,007
  • 2
  • 11
  • 30
  • If I set $i = 0; before the settings posted before, I don't have error messagge, but I don't see a drop down menu that allow me to choose the database. – famedoro Jul 06 '17 at 09:11
  • There might be other error in your code or some missing functionality. – Samir Selia Jul 06 '17 at 09:15