mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
improve mysqli connection settings - see https://github.com/postfixadmin/postfixadmin/issues/73
This commit is contained in:
parent
82e7bdfda3
commit
4b999b3f6b
@ -86,11 +86,17 @@ $CONF['database_host'] = 'localhost';
|
|||||||
$CONF['database_user'] = 'postfix';
|
$CONF['database_user'] = 'postfix';
|
||||||
$CONF['database_password'] = 'postfixadmin';
|
$CONF['database_password'] = 'postfixadmin';
|
||||||
$CONF['database_name'] = 'postfix';
|
$CONF['database_name'] = 'postfix';
|
||||||
|
|
||||||
// If you need to specify a different port for a MYSQL database connection, use e.g.
|
// If you need to specify a different port for a MYSQL database connection, use e.g.
|
||||||
// $CONF['database_host'] = '172.30.33.66:3308';
|
// $CONF['database_host'] = '172.30.33.66:3308';
|
||||||
// If you need to specify a different port for POSTGRESQL database connection
|
//
|
||||||
|
// If you need to specify a different port for MySQLi(3306)/POSTGRESQL(5432) database connection
|
||||||
// uncomment and change the following
|
// uncomment and change the following
|
||||||
// $CONF['database_port'] = '5432';
|
// $CONF['database_port'] = '5432';
|
||||||
|
//
|
||||||
|
// If you wish to connect using a local socket file (e.g /var/run/mysql.sock) uncomment the below.
|
||||||
|
// $CONF['database_socket'] = '/var/run/mysql/mysqld.sock';
|
||||||
|
//
|
||||||
// If sqlite is used, specify the database file path:
|
// If sqlite is used, specify the database file path:
|
||||||
// $CONF['database_name'] = '/etc/postfix/sqlite/postfixadmin.db'
|
// $CONF['database_name'] = '/etc/postfix/sqlite/postfixadmin.db'
|
||||||
|
|
||||||
|
@ -1271,14 +1271,17 @@ function db_connect ($ignore_errors = false) {
|
|||||||
}
|
}
|
||||||
} elseif ($CONF['database_type'] == "mysqli") {
|
} elseif ($CONF['database_type'] == "mysqli") {
|
||||||
if (function_exists ("mysqli_connect")) {
|
if (function_exists ("mysqli_connect")) {
|
||||||
$link = @mysqli_connect ($CONF['database_host'], $CONF['database_user'], $CONF['database_password']) or $error_text .= ("<p />DEBUG INFORMATION:<br />Connect: " . mysqli_connect_error () . "$DEBUG_TEXT");
|
|
||||||
|
$CONF['database_socket'] = isset($CONF['database_socket']) ? $CONF['database_socket'] : ini_get('mysqli.default_socket');
|
||||||
|
$CONF['database_port'] = isset($CONF['database_port']) ? $CONF['database_socket'] : ini_get('mysqli.default_port');
|
||||||
|
|
||||||
|
$link = @mysqli_connect ($CONF['database_host'], $CONF['database_user'], $CONF['database_password'], $CONF['database_name'], $CONF['database_port'], $CONF['database_socket']) or $error_text .= ("<p />DEBUG INFORMATION:<br />Connect: " . mysqli_connect_error () . "$DEBUG_TEXT");
|
||||||
if ($link) {
|
if ($link) {
|
||||||
@mysqli_query($link,"SET CHARACTER SET utf8");
|
@mysqli_query($link,"SET CHARACTER SET utf8");
|
||||||
@mysqli_query($link,"SET COLLATION_CONNECTION='utf8_general_ci'");
|
@mysqli_query($link,"SET COLLATION_CONNECTION='utf8_general_ci'");
|
||||||
@mysqli_select_db ($link, $CONF['database_name']) or $error_text .= ("<p />DEBUG INFORMATION:<br />MySQLi Select Database: " . mysqli_error ($link) . "$DEBUG_TEXT");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$error_text .= "<p />DEBUG INFORMATION:<br />MySQL 4.1 functions not available! (php5-mysqli installed?)<br />database_type = 'mysqli' in config.inc.php, are you using a different database? $DEBUG_TEXT";
|
$error_text .= "<p />DEBUG INFORMATION:<br />MySQLi functions not available! (php5-mysqli installed?)<br />database_type = 'mysqli' in config.inc.php, are you using a different database? $DEBUG_TEXT";
|
||||||
}
|
}
|
||||||
} elseif (db_sqlite()) {
|
} elseif (db_sqlite()) {
|
||||||
if (class_exists ("SQLite3")) {
|
if (class_exists ("SQLite3")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user