-
Notifications
You must be signed in to change notification settings - Fork 301
Database connection
If you use one of the forum integration versions (phpBB3, phpBB2, MyBB, PunBB, SMF or vBulletin version), AJAX Chat uses the existing database connection of your forum.
In most cases, you can therefore set all database configuration settings to null (which is the default in these versions):
// Database connection values: $config['dbConnection'] = array(); // Database hostname: $config['dbConnection']['host'] = null; // Database username: $config['dbConnection']['user'] = null; // Database password: $config['dbConnection']['pass'] = null; // Database name: $config['dbConnection']['name'] = null; // Database type: $config['dbConnection']['type'] = null; // Database link: $config['dbConnection']['link'] = null;
If you prefer to use another database for the chat, you'll need to comment out a line in lib/class/CustomAJAXChat.php, e.g. for the phpBB3 integration version, you'll have to comment out the following:
// Use the existing phpBB database connection: $this->setConfig('dbConnection', 'link', $db->db_connect_id);After doing this you can set the database configuration settings alike the standalone version.
There is one case where you'll get a database connection error (apart from providing the wrong database details):
That's when you server is capable of MySQL Improved (MySQLi), but you chose standard MySQL (without the "i" for Improved) for your forum setup.
AJAX Chat uses MySQLi if possible - and the existing database connection link of your forum.
So if your forum uses MySQL, the database connection link will be no MySQLi database connection object but just a MySQL database connection identifier - if MySQLi is available AJAX Chat will expect a MySQLi database connection object nonetheless and therefore this setup will result in an error.
If you are in doubt just try the following setting in lib/config.php:
$config['dbConnection']['type'] = 'mysql';This tells AJAX Chat to use MySQL even if MySQLi is available.
If you are using the standalone version, following the provided readme and setting host, user, pass and the name of your database should work out:
$config['dbConnection']['host'] = 'your_database_hostname'; $config['dbConnection']['user'] = 'your_database_username'; $config['dbConnection']['pass'] = 'your_database_password'; $config['dbConnection']['name'] = 'your_database_name';Note: your_database_hostname will be just localhost on most setups.