mysql hostname is "server3" instead of "localhost"

hi guys,
i have struck upon a problem that i think i may have been aluding to when asking questions about hosthames and hosts file configuration.

I am now installing boxbilling onto a server i setup…

virtualmin>virtual server>

box billing takes me through asking for the following

Database hostname:

Database name:

Database user:

Database password:

no i have had no problems completing everything on the above with the exception of “Database hostname”. I thought that it would be “localhost”, however, this doesnt work.
I went into command shell and did the following steps

1. mysql -u myusername -p (and hit enter)
2. enterred my user password (and hit enter)
3. MariaDB [(none)]> SHOW VARIABLES WHERE Variable_name = ‘hostname’; (and hit enter)
| Variable_name | Value |
| hostname | server3 |
1 row in set (0.01 sec)

As you can clearly see, the mariadb hostname is “server3” and not “localhost”. However, when i look in mysql server configuration in virtualmin, the MySQL listening address is (and i saw somewhere else in virtualmin (i forget where) that the server is called localhost)

I am now a little confused as boxbilling setup will not allow me past the database setup page.

Here is the php_error log for box billing installation…
#0 /home/billing/public_html/install/index.php(67): Box_Installer->canConnectToDatabase(‘localhost’, ‘billing’, ‘billing’, ‘mypassword’)
#1 /home/billing/public_html/install/index.php(466): Box_Installer->run(‘check-db’)
#2 {main}
thrown in /home/billing/public_html/install/index.php on line 201
[13-Oct-2017 06:14:12 UTC] PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/billing/public_html/install/index.php:201

and here is /install/index.php lines 199-208

private function canConnectToDatabase($host, $db, $user, $pass)
$link = @mysql_connect($host, $user, $pass);
if ($link) {
$db_selected = @mysql_select_db($db, $link);
if($db_selected) {
return true;

Here is a google drive link to install/index.php

Ok, so i have updated this section of boxbilling code so it reads “mysqli” instead of “mysql” (i assume this is what the latest version of php uses?).

Now i am getting an error popup saying cannot connect to database. (hopefully this is progress?)

I now go back to the hostname…should it be server3 or localhost?

Hi Adam
I would try using your ip address in place of localhost as long as your user in not bound to localhost , when you set it up.

Also you can make sure that - you have enabled MySQLi extension in php.ini,

Hope this helps

Kind Regards

I have checked Virtualmin>Edit Databases>Remote Hosts>

This form lists remote hosts that are allowed to connect to databases owned by this virtual server, and any sub-servers. These apply to the domain owner and any other users with MySQL access.
Allowed hosts for MySQL

I suspect this means that i should be using “localhost” as the hostname for database?

I have dropped and recreated database again to be absolutely sure…

My database name is “billing” (checked and tripple checked)
mysql username is “billing” (checked and tripple checked)
password is definately correct (as the correct password i have assigned/chosen is being displayed in the php_error log)

A little question about php.ini mysqli when access via webmin>phpconfiguration>Edit Configuration Manually…should the following be blank

mysqli.default_socket =
mysql.default_host =
mysqli.default_user =
mysqli.default_pw =

my assumption is that it must get this information from somewhere on the run?

Hi Adam

I went with WHMCS about 8 years ago after testing all the market offerings

I have also on occasion looked at alternatives for projects - but to be honest I think it was one of my best decision - going with WHMCS - it does just work and once you start generating monthly invoices for customers and domain renewals their monthly license fee becomes a well spent investment. (I have had a few issues but their tech has fixed it for me straight away.) And of course you can install it on Virtualmin out of the box …

On a small project I have used an invoicing system that generates re-occurring invoices this need to be manually setup and there is no auto signup but there is also no ongoing monthly costs - I see something like invoice ninja - could be used and supports online payments.

All the best

Yes i also have whmcs running too on another virtualmin virtual server account. Whmcs is by far the least problematic to setup.
I am experimenting with these alternatives…boxbilling clearly is not coded well…or isnt up to date with its code…the databse connectivity issue i experience with boxbilling isnt replicated with hopebilling (even using the same user and database i attempted with boxbilling, hopebilling install has no databse connectivity issue).