A little while ago, both the AJAX Chat servers, the main one on Quackhouse Radio server, as well as the backup on the KRAB radio server crapped out. I’ll fill you in how I fixed it, as well as the symptom.
The symptom was that if a connected user just closed their browser instead of using the LOGOUT button, the chat server would crash, and the next person to try to log in, would get something like this in their browser:
Query: INSERT INTO `AJAXChat`.ajax_chat_messages( userID, userName, userRole, channel, dateTime, ip, text ) VALUES ( ‘5150515051’, ‘[KRAB]’, ‘4’, ‘0’, NOW(), ‘��’, ‘/logout Cap Timeout’ ); Error-Report: Out of range value for column ‘userID’ at row 1 Error-Code: 1264
Pretty much undecipherable, unless you are a linux sql geek like I am. 😀 The way to get past this would be to use install.php to reinitialize the database tables. However, the next time a user fails to log out properly, the same thing happens. Here’s how I fixed the backup server.
It can be done using the command line, but the easiest way is using phpMyAdmin. So, if you don’t have it, you must install it. It is set by default to only allow connections from localhost, so keep that in mind.
First thing to do is to either Remove or Rename the AJAXChat database. Login to phpMyAdmin and click on the AJAXChat database, then select Operations. Then, either Remove, or Rename it. I chose to Rename it rather that Remove it. I can always Remove it later.
Second thing to do, is to add a new user and top level database. Click on New (on the left), then User Accounts. Click on Add User Account. Type the access info you want in the Login information area. (username, host, password.) FYI, the host should be localhost. 😉 Then click on the radio button for Create database with the same name and grant all privileges. Then, click Go.
Finally, you need to go to the config.php script in the AJAXChat lib directory, and open it in your editor. I prefer to use nano, but you can use ed, vim, or a host of others. Then, you need to update the config.php. You will need to update the user, password, and database name that you just set up.
Then, you just need to rerun the install.php, it it will recreate everything automatically.
Now, the only time you should end up with that sql garbage when trying to login to AJAXChat, is if that login is currently logged in…. 😉
That’s it! With luck, that will take care of your issue.