title: mysql_connect(): Headers and client library minor version mismatch. Headers:50531 Library:50613
body: <p>I'm really stuck trying to fix these errors on debian wheezy.</p>
  
  <blockquote>
    <p>mysql_connect(): Headers and client library minor version mismatch. Headers:50531 Library:50613 core.php on line 317</p>
  </blockquote>
  
  <p>The problem occured today quite a while after an upgrade to php 5.4, ioncube loaders 4.4.3, xcache 3.0.3 and percona 5.6. </p>
  
  <p>So far in my attempts to fix the problem I've tried... </p>
  
  <ol>
  <li>Uninstalling php (including purging the install files)</li>
  <li>Downgrading to php 5.3 then upgrading back</li>
  <li>Downgrading back to percona 5.5 and upgrading back</li>
  <li>Unloading ioncube headers</li>
  <li>Unloading xcache</li>
  </ol>
  
  <p>None of which has helped unfortunately...</p>
  
  <h2>--</h2>
  
  <p>Line 317 starts with:</p>
  
  <pre><code> $link = $this-&gt;
  </code></pre>
  
  
  
  <pre><code>  /**
      * Initialize database connection(s)
      *
      * Connects to the specified master database server, and also to the slave server if it is specified
      *
      * @param        string  Name of the database server - should be either 'localhost' or an IP address
      * @param        integer Port of the database server (usually 3306)
      * @param        string  Username to connect to the database server
      * @param        string  Password associated with the username for the database server
      * @param        boolean Whether or not to use persistent connections to the database server
      * @param        string  Not applicable; config file for MySQLi only
      * @param        string  Force connection character set (to prevent collation errors)
      *
      * @return       boolean
      */
      function db_connect($servername, $port, $username, $password, $usepconnect, $configfile = '', $charset = '')
      {
              if (function_exists('catch_db_error'))
              {
                      set_error_handler('catch_db_error');
              }
  
              // catch_db_error will handle exiting, no infinite loop here
              do
              {
                      $link = $this-&gt;functions[$usepconnect ? 'pconnect' : 'connect']("$servername:$port", $username, $password);
              }
              while ($link == false AND $this-&gt;reporterror);
  
              restore_error_handler();
  
              if (!empty($charset))
              {
                      if (function_exists('mysql_set_charset'))
                      {
                              mysql_set_charset($charset);
                      }
                      else
                      {
                              $this-&gt;sql = "SET NAMES $charset";
                              $this-&gt;execute_query(true, $link);
                      }
              }
  
              return $link;
      }
  </code></pre>