Using different MySQL port for the JTS3ServerMod Web Interface

Started by Stefan1200, January 31, 2016, 11:55:20 AM

Previous topic - Next topic

Stefan1200

The JTS3ServerMod itself allows to set a different MySQL port. The current version of the Web Interface just use the default MySQL port, which is set at the MySQLi module in the php.ini, value name: mysqli.default_port

If you can't change that value (maybe it's not your web server or you use different MySQL servers for hosted web pages), you can't change that value in the current version of the JTS3ServerMod Web Interface. But you can hard code the MySQL port number by doing a simple change to two PHP files.

Open the file class/dbconnect.php, line 22
$this->link = mysqli_connect($config[1], $config[2], $config[3], $config[4]);
change to (example port 3307)
$this->link = mysqli_connect($config[1], $config[2], $config[3], $config[4], 3307);

Open the file install.php, line 230
$dblink = mysqli_connect($_POST['mysqlhost'], $_POST['mysqluser'], $_POST['mysqlpassword'], $_POST['mysqldatabase']);
change to (example port 3307)
$dblink = mysqli_connect($_POST['mysqlhost'], $_POST['mysqluser'], $_POST['mysqlpassword'], $_POST['mysqldatabase'], 3307);

After doing this two changes, just start the installation of the Web Interface using the install.php file. The line number might change in future versions, just make sure to find the mysqli_connect line. Make sure to redo this changes, if you update this files of the Web Interface in the future.

If more people write to me, that they need this option implemented by default, I can add this. But I think this manual change is quite easy and the 1 or 2 people, who don't use the default MySQL port, can do it.