-
Improvement
-
Resolution: Fixed
-
Major
-
2.0.1
-
MYSQL
* Server: Localhost via UNIX socket
* version: 5.5.8
* Protocol version: 10
* user: root@localhost
* charset: UTF-8 Unicode (utf8)
Webserver
* Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8o
* MySQL client lib: 5.5.8
* PHP-kiterjesztés: mysqli
* PHP: 5.3.4
-
MySQL
-
MOODLE_20_STABLE
-
MOODLE_20_STABLE
-
Moderate
In a chroot jailed environment, using socket only mysqli connection, I always got:
[Sat Jan 08 17:55:56 2011] [error] [client 193.225.122.131] PHP Warning: mysqli::mysqli() expects parameter 5 to be long, string given in /web/www/openwide-moodle/
lib/dml/mysqli_native_moodle_database.php on line 276
[Sat Jan 08 17:55:56 2011] [error] [client 193.225.122.131] PHP Warning: mysqli::set_charset() [<a href='mysqli.set-charset'>mysqli.set-charset</a>]: Couldn't fetch
mysqli in /web/www/openwide-moodle/lib/dml/mysqli_native_moodle_database.php on line 286
[Sat Jan 08 17:55:56 2011] [error] [client 193.225.122.131] PHP Warning: mysqli_native_moodle_database::get_server_info() [<a href='mysqli-native-moodle-database.
get-server-info'>mysqli-native-moodle-database.get-server-info</a>]: Couldn't fetch mysqli in /web/www/openwide-moodle/lib/dml/mysqli_native_moodle_database.php on
line 326
[Sat Jan 08 17:55:56 2011] [error] [client 193.225.122.131] PHP Warning: mysqli_native_moodle_database::get_server_info() [<a href='mysqli-native-moodle-database.get-server-
info'>mysqli-native-moodle-database.get-server-info</a>]: Couldn't fetch mysqli in /web/www/openwide-moodle/lib/dml/mysqli_native_moodle_database.php on line 326
[Sat Jan 08 17:55:56 2011] [error] [client 193.225.122.131] PHP Warning: mysqli::query() [<a href='mysqli.query'>mysqli.query</a>]: Couldn't fetch mysqli in /web/www/
openwide-moodle/lib/dml/mysqli_native_moodle_database.php on line 769
[Sat Jan 08 17:55:56 2011] [error] [client 193.225.122.131] PHP Fatal error: Call to a member function fetch_assoc() on a non-object in /web/www/openwide-moodle/lib/dml/
mysqli_native_moodle_database.php on line 774
[Sat Jan 08 17:56:13 2011] [error] [client 193.225.122.131] Default exception handler: Error reading from database Debug: No database selected\nSHOW TABLES\n[NULL]\n* line 391 $
line 1366 of /lib/upgradelib.php: call to mysqli_native_moodle_database->get_tables()\n* line 100 of /admin/index.php: call to core_tables_exist()\n
I could narrow the problem to mysqli_native_moodle_database.php. Int hat I made the following hard-coding with my very basic php knowledge:
this (line 276):
$this->mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname, $dbport);
to this:
$this->mysqli = new mysqli('localhost', $dbuser, $dbpass, $dbname, 3306, "/web/mysql/mysql.sock" );
(dport varible were unset, socket missing)
my config.php settings:
$CFG->dbtype = 'mysqli';
$CFG->dbhost = 'localhost:/web/mysql/mysql.sock';
$CFG->dbname = 'moodle_openwide';
$CFG->dbuser = 'moodle_openwide';
$CFG->dbpass = password;
$CFG->prefix = 'mdl_';
$CFG->dblibrary = 'native'; // 'native' only at the moment
$CFG->dboptions = array(
'dbpersist' => true, // should persistent database connections be
// used? set to 'false' for the most stable
// setting, 'true' can improve performance
// sometimes
'dbsocket' => true, // should connection via UNIX socket be
// used? if you set it to 'true' here,
// set dbhost to 'localhost'
'dbport' => '', // the TCP port number to use when connecting
// to the server. keep empty string for the
// default port
);
since I was unable to specify elsewhere the socket path, I had to define in the dbhost. That's why it contains more than just localhost...