Support » Plugin: SQL Executioner » Small tweak (included) needed for non-default ports

  • @justincwatt

    Thanks for the plugin. I’ve been using it a long while.

    The DB_HOST constant in wp-config.php can contain a non-default port. The plugin falls over with this. Here’s how to fix it:


    $this->db = mysqli_connect( DB_HOST, DB_USER, DB_PASSWORD, DB_NAME );


    $host = preg_match('/^(\S+):(\d+)$/', DB_HOST, $matches) ? $matches[1] : DB_HOST;
    $port = preg_match('/^(\S+):(\d+)$/', DB_HOST, $matches) ? $matches[2] : ini_get('mysqli.default_port');
    $this->db = mysqli_connect( $host, DB_USER, DB_PASSWORD, DB_NAME, $port );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Small tweak (included) needed for non-default ports’ is closed to new replies.