I'm getting a new box ready to use for our internal server. I've got ejabberd installed for instant messaging, BIND for DNS, samba for file sharing, apache 2.2 for serving internal web pages, NAT for masquerading with a rather relaxed pf rule set, and so forth.
Bandersnatch is a utility that will log instant messages to a database. Unfortunately, there's not a port for it, so I had to resort to installing it manually. I selected MySql 5.1 and installed that from ports, then configured it and got it running before creating the databases bandersnatch requires. It works great in that all instant messages are dumped to a database. However, I'm having one small problem.
Bandersnatch comes with a web-based user interface that allows one to view statistics and, if you have admin rights, view the messages. (I have apache set up to serve pages out of the front end directory if you go to chatlog.<boxname via DNS> so I can get away from remembering so many IPs.) I set things up the way I believe they should be, but cannot seem to make it work. I'm out of my element when it comes to PHP and was hoping somebody could provide insight of where I should look or how I might go about fixing it.
My gut feeling is that something in PHP or the PEAR modules that it relies upon isn't set up correctly. I installed what it was complaining about from ports and enabled php5_module in the httpd.conf config file. Looking in the code for the bandersnatch front end file, the error I'm getting is produced if there is an error connecting to the database.
I've disabled pf completely to eliminate a TCP port being blocked being the trouble, but that made no difference. I've also verified the bandersnatch user and password has access to the bandersnatch database. Since there's nothing of any use in the logs, I'm frankly at a loss of where to look next.
Thanks in advance for any pointers.
Bandersnatch is a utility that will log instant messages to a database. Unfortunately, there's not a port for it, so I had to resort to installing it manually. I selected MySql 5.1 and installed that from ports, then configured it and got it running before creating the databases bandersnatch requires. It works great in that all instant messages are dumped to a database. However, I'm having one small problem.
Bandersnatch comes with a web-based user interface that allows one to view statistics and, if you have admin rights, view the messages. (I have apache set up to serve pages out of the front end directory if you go to chatlog.<boxname via DNS> so I can get away from remembering so many IPs.) I set things up the way I believe they should be, but cannot seem to make it work. I'm out of my element when it comes to PHP and was hoping somebody could provide insight of where I should look or how I might go about fixing it.
My gut feeling is that something in PHP or the PEAR modules that it relies upon isn't set up correctly. I installed what it was complaining about from ports and enabled php5_module in the httpd.conf config file. Looking in the code for the bandersnatch front end file, the error I'm getting is produced if there is an error connecting to the database.
I've disabled pf completely to eliminate a TCP port being blocked being the trouble, but that made no difference. I've also verified the bandersnatch user and password has access to the bandersnatch database. Since there's nothing of any use in the logs, I'm frankly at a loss of where to look next.
Code:
/var/log/chatlog-access.log:
<clientIP> - - [03/Feb/2010:17:46:44 -0500] "GET /HTTP/1.1" 200 2802
<clientIP> - - [03/Feb/2010:17:46:44 -0500] "GET /images/jabberwocky.jpg HTTP/1.1" 304 -
/var/log/chatlog-error.log
empty
/var/log/mysql.log:
100128 21:24:20 mysqld_safe mysqld from pid file /var/run/mysql/mysql.pid ended
100128 21:25:08 mysqld_safe Starting mysqld daemon with databases from /home/mysql
100128 21:25:08 [Note] Plugin 'FEDERATED' is disabled.
100128 21:25:08 InnoDB: Started; log sequence number 0 44233
100128 21:25:08 [Note] Event Scheduler: Loaded 0 events
100128 21:25:08 [Note] /usr/local/libexec/mysqld: ready for connections.
Version: '5.1.42' socket: '/tmp/mysql.sock' port: 3306 FreeBSD port: mysql-server-5.1.42
the start of the bandersnatch front end file:
<?php
$config['template'] = 'default.tpl.htm';
$config['limit'] = '100';
$config['database_type'] = 'mysql';
$config['database_host'] = '127.0.0.1';
///////I've tried localhost, the host name, the name of the box via DNS, the loopback IP, and the IP of the machine for the database_host parameter with no luck\\\\\\\\\
$config['database_table'] = 'bandersnatch';
$config['database_user'] = 'bandersnatch';
$config['database_password'] = 'bandersnatch';
$config['local_server'] = "127.0.0.1";
$config['local_domains'] = array
(
'<boxname via DNS>',
'chat.<boxname via DNS>'
);
$config['local_transports'] = array
(
// 'groupchat' => 'conference.jabber.yourdomain.com'
);
);
#################### End of user-configurable options #######################
$config['app_version'] = '0.2';
$config['app_name'] = 'Bandersnatch PHP Frontend';
// Setup database DSN
$dsn = $config['database_type']. "://". $config['database_user']. ":". $config['database_password'];
$dsn .= "@". $config['database_host']. "/". $config['database_table'];
// Load PEAR Integrated Template libraries
require_once "HTML/Template/IT.php";
$tpl = new HTML_Template_IT("../templates");
$tpl->loadTemplatefile($config['template'], true, true);
// Load PEAR DB Libraries
require_once( 'DB.php' );
require_once( '../includes/functions.inc.php' );
$db = DB::connect($dsn);
if (DB::isError($db)) { generate_error('Database connection error - '. $dsn); }
/////////////////This is the error I'm getting\\\\\\\\\\\\\\\\\
// Load PEAR Auth libraries
require_once "Auth/Auth.php";
$a = new Auth("DB", $dsn);
$a->setShowLogin( false ); // Don't automatically show login page, we'll do it ourselves
// Note. 2003-02-13: Noticed today that if the Auth connection fails (I had a bad DSN), no decent error
// message is given. I got a "non-existant function query()" error :(
bandersnatch config:
<config>
<server>
<connectiontype>tcpip</connectiontype>
<hostname>localhost</hostname>
<port>5526</port>
<secret>bandersnatch</secret>
</server>
<component>
<name>bandersnatch@bandersnatch.localhost</name>
</component>
<mysql>
<server>localhost</server>
<dbname>bandersnatch</dbname>
<username>bandersnatch</username>
<password>bandersnatch</password>
</mysql>
<debug>
<level>0</level>
<file>stdout</file>
</debug>
<site>
<local_server>localhost</local_server>
<admin_jids>My_Jabber_ID@localhost</admin_jids>
<privacy>0</privacy>
<aggressive_presence>0</aggressive_presence>
</site>
</config>
Thanks in advance for any pointers.