Skip to main content
 

PhpMyAdmin: Aggiungere più di un server

Per gestire più di un server MySql, occorre intervenire sul file config.inc.php sotto la home di installazone di PhpMyAdmin:

/*
 * Servers configuration
 */
$i = 0;
 
/*
 * First server
 */
$i++;
 
/* Authentication type and info */
$cfg['Servers'][$i]['auth_type']        = 'config';
$cfg['Servers'][$i]['user']             = '{username}';
$cfg['Servers'][$i]['password']         = '{password}';
$cfg['Servers'][$i]['AllowNoPassword']  = true;
 
/* Server parameters */
$cfg['Servers'][$i]['host']             = '{servername}';
$cfg['Servers'][$i]['connect_type']     = 'tcp';
$cfg['Servers'][$i]['compress']         = false;
 
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysqli';
 
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';
 
/* Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb']            = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable']    = 'pma_bookmark';
$cfg['Servers'][$i]['relation']         = 'pma_relation';
$cfg['Servers'][$i]['table_info']       = 'pma_table_info';
$cfg['Servers'][$i]['table_coords']     = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages']        = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info']      = 'pma_column_info';
$cfg['Servers'][$i]['history']          = 'pma_history';
$cfg['Servers'][$i]['designer_coords']  = 'pma_designer_coords';
 
Now go on adding the second, third, forth server..

Don't forget to add $i++ before starting configuration of a new server:

/*
 * Second server
 */
$i++;
...
...

PHP, MySQL

Connettersi a SQLServer

Ecco i passaggi da eseguire per connetterisi ad un server MS SQLServer, con PHP da un web server Apache installato su sistema Ubuntu. Per prima cosa occorre installare il driver con

sudo apt-get install php5-sybase.

Subito dopo riavviare Apache. A questo punto PHP è già pronto per connettersi. Ecco del codice di esempio:


$server = ':\';
$link = mssql_connect($server, '', '');

if (!$link) {
 die('Something went wrong while connecting to MSSQL');
}

$selected = mssql_select_db('', $link) or 
 die("Couldn't open database databasename");

$result = mssql_query('select column_name from table_name');

while($row = mssql_fetch_array($result))
 echo $row["COLUMN_NAME"] . ' ';

SQL Server, PHP