i found that the mysql container code contains some deprecated calls, specifically
this in line 109 of mysql.class.php
- Code: Select all
$db_list = mysql_list_dbs($db);
while (!$db_exists && $row = mysql_fetch_object($db_list))
{ $db_exists = ($c->container_cfg_mysql_database == $row->Database); }
Im using a server that has PHP 5.4.0+ and according to following page:
php.net/manual/en/function.mysql-list-dbs.php
the "mysql_list_dbs" is deprecated, leading to a bug that PFC cant check the existence
of a previously created database, which further leading to re-creation of database by pfc,
producing the final error "mysql container: error on creating database; database already here"
or something similar...
I fixed this problem by using this simpler code (instead of the above function)
- Code: Select all
$db_selected = mysql_select_db($c->container_cfg_mysql_database, $db);
if (!$db_selected) {
die ('Mysql container:' . mysql_error());
} else { $db_exists = TRUE; }
the above tries at first to connect to the database specified in php script, and if that
fails then PFC tries to create the database; otherwise db is selected & $db_exists becomes TRUE,
bypassing the creation. Note that the problem arises in first place by the above deprecated
function,
* This stuff works on servers where CREATE DATABASE privilege is locked.
** ..but if the user didnt already created his database by-hand he would still have problem,
because of database creation that PFC is doing by itself (i think its bad..; let users create it and
just select it in pfc code)