MyBB Community Forums

Full Version: Using MYSQLI_CLIENT_COMPRESS for speed with mysqli_real_connect
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This may vary on your use case. In my case I have a separate database server and wanted to compress data to make it more efficient to send over.

Requires edit to inc\db_mysqli.php
Find
if($port)
{
$this->$link = @$connect_function($persist.$hostname, $single_connection['username'], $single_connection['password'], "", $port);
}
else
{
$this->$link = @$connect_function($persist.$single_connection['hostname'], $single_connection['username'], $single_connection['password']);
}


Change to
$this->$link = mysqli_init();

if($port)
{
mysqli_real_connect($this->$link, $persist.$hostname, $single_connection['username'], $single_connection['password'], $port,0,MYSQLI_CLIENT_COMPRESS);
}
else
{
mysqli_real_connect($this->$link, $persist.$single_connection['hostname'], $single_connection['username'], $single_connection['password'], '',0,MYSQLI_CLIENT_COMPRESS);
}