Announcement

Collapse
No announcement yet.

mysqli_set_charset() warning then using mysqli_slave

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • mysqli_set_charset() warning then using mysqli_slave

    Hi

    I just wanted to activate mysqli slave on our forums, however I notice the following warning on top of every page when mysqli_slave is active in the config.php:

    Warning: mysqli_set_charset(): invalid object or resource mysqli in [path]/includes/class_core.php on line 1366

    The line segment is in the class vB_Database_MySQLi:

    PHP Code:
    if (!empty($charset))

        {

        if (
    function_exists('mysqli_set_charset'))

        {

        
    mysqli_set_charset($link$charset);

    We use it in combination with the charset option in config.php:
    Code:
    $config['Mysqli']['charset'] = 'utf8';
    so I see how the parser is getting there. However, is this a configuration issue on our end? What information do you need if so? Or is it a bug with php/vb4?

    Version: vB 4.2.0 PL3
    PHP Version 5.3.18-nmm1

  • #2
    Above the line

    Code:
    mysqli_set_charset($link, $charset);
    Add

    Code:
    $charset = 'utf8';
    See if that helps...

    If it doesn't we know the issue is with $link

    Comment


    • #3
      Hi

      I inserted it like this:

      PHP Code:
                      restore_error_handler();



                     if (!empty(
      $charset))

                     {

                             if (
      function_exists('mysqli_set_charset'))

                             {

      // test123

      $charset 'utf8';

                                     
      mysqli_set_charset($link$charset);

                             }

                             else

                             {

                                     
      $this->sql "SET NAMES $charset";

                                     
      $this->execute_query(true$link);

                             }

                     }



                     return (!
      $connect) ? false $link
      But the error was still there. Something with the $link seems to be wrong.

      The funny thing is, in one of our other forums, it all works with mysqli_slave, but not on the one I tested. We use the same files (we have a svn repo for all forums) I just checked the config.php files with diff, both are identical when it comes to other settings than db credentials.

      Any ideas why this might be happening in one forum but not the other with effectively the same config files?

      //e:

      Concerning the error happening in one forum and not the other, maybe in the forums where the warning doesn't appear, maybe there is some kind of error supression. I don't have direct access to the server configuration, so the best thing would be to try to solve the warning itself. We really rely on the charset being set in mysql, otherwise we run in problems with special chars (äöü)
      Last edited by Disasterpiece; Sat 13 Apr '13, 7:07am.

      Comment


      • #4
        Really warnings should be suppressed on live sites anyway, that was going to be my next idea- if it's not hurting anything just stop displaying warnings.

        Add this to the top of config.php, directly under <?php

        error_reporting(0);

        Comment


        • #5
          While that's true that hidden warnings don't hurt anyone (except the log which will explode) I'm curious as to why this happens. Is it a bug with vb? Or is it an indicator that the slave connection can't be established and the forum falls back to one single connection?
          That's fairly important to me since theres a HUGE difference in server performance if the slave functionality doesn't work and we really need it.

          Is there a way to reliably determine if the master-slave functionality is actually working? The only difference i found so far is that if slave is active, the SQL Explain functionality would only display a blank page instead of the explained SQL queries

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...
          X