Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-25910

can not install using custom mysql or postgresql socket location

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.2
    • Component/s: Installation
    • Labels:
    • Environment:
    • Database:
      MySQL
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      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...

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  21/Feb/11