[Mapbender-dev] mysql_connect() instead mysql_dconnect() in
database-mysql.php
k.schmidt
ks at mapmedia.de
Fri Nov 13 04:35:31 EST 2009
Hello,
we have found an improvement for the file:
/php/database-mysql.php
for the database-conection.
At line 84:
if ($sys_db_use_replication) {
//
// if configured for replication, $conn is the read-only host
// we do not connect to update server until needed
//
$conn = @mysql_pconnect($sys_dbreadhost,$sys_dbuser,$sys_dbpasswd);
$conn_update=@mysql_pconnect($sys_dbhost,$sys_dbuser,$sys_dbpasswd);
} else {
$conn =
@mysql_pconnect($sys_dbhost.$sys_dbport,$sys_dbuser,$sys_dbpasswd);
#echo
"@mysql_pconnect($sys_dbhost.$sys_dbport,$sys_dbuser,$sys_dbpasswd)";
}
should be changed to:
if ($sys_db_use_replication) {
//
// if configured for replication, $conn is the read-only host
// we do not connect to update server until needed
//
$conn = mysql_connect($sys_dbreadhost,$sys_dbuser,$sys_dbpasswd);
$conn_update= mysql_connect($sys_dbhost,$sys_dbuser,$sys_dbpasswd);
} else {
# Create a new connection...
if( version_compare( PHP_VERSION, '4.2.0', 'ge' ) ) {
$conn = mysql_connect( $sys_dbhost,$sys_dbuser,$sys_dbpasswd,
true );
} else {
# On PHP 4.1 the new_link parameter is not available. We cannot
# guarantee that we'll actually get a new connection, and this
# may cause some operations to fail possibly.
$conn = mysql_connect( $sys_dbhost,$sys_dbuser,$sys_dbpasswd );
}
}
We searched a long, long time for the reason why there from time to time
hanging of some scripts.
Now we found that persistent MySql-Conections are cut by our Firewall.
php.net also says that
mysql_pconnect();
needs special server settings
(http://de3.php.net/manual/de/function.mysql-pconnect.php).
K. Schmidt
More information about the Mapbender_dev
mailing list