Install problem- blank screen in browser

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
intuiworx
Posts: 3
Joined: Tue Mar 11, 2008 4:05 pm

Install problem- blank screen in browser

Post by intuiworx »

CentOS 5
PHP 5.1.6
MySQL 5.0.22
Cacti 0.8.7 (installed via yum from DAG's repo)

Anyway, I went through the install, made the necessary PHP/Apache config changes, created and filled the db... navigated to /cacti, and all I got was a blank screen. I verified that I was looking in the right dir and that PHP was parsing correctly with a few test scripts, then went to town trying to pin the problem down.

I finally found where in the code things are taking a dump. index.php includes auth.php, which in turn includes global.php. From there, the function db_connect_real() is called, and it's in there that things croak. I put some debugging code into the db_connect_real() function in /lib/database.php, and everything executed fine until we reach the following loop:

Code: Select all

 while ($i <= $retries) {
                if ($cnn_id->PConnect($hostport,$user,$pass,$db_name)) {

                        return(1);
                }
                $i++;

                usleep(40000);
        }
Any ideas what might be going wrong here? I verified that all vars are being passed to the function OK...
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Hi

have you configured include/config.php ?

Also, do you have any error in /var/log/http/error_log ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
intuiworx
Posts: 3
Joined: Tue Mar 11, 2008 4:05 pm

Post by intuiworx »

Yup, config.php is configured correctly, and I verified that the values being passed to the function for hostname, user, pass, etc are all correct. Nothing's being written to error_log either.

Debugging code placed inside the loop but before the if statement is executed. Any code after the if conditional isn't, so I'm fairly certain something is buggering up when the PConnect() method gets called. I'm continuing to dig deeper into this, but I figured it was worth asking on here to see if I could possibly save myself some time debugging...
intuiworx
Posts: 3
Joined: Tue Mar 11, 2008 4:05 pm

Post by intuiworx »

Fixed this... there was a misconfiguration in php.ini, thus hosing the MySQL stuff.
greginmadison
Posts: 30
Joined: Fri Mar 07, 2008 8:58 am

How did you find the error in your php file?

Post by greginmadison »

I have same problem, trouble shot it down to the PConnect function gets called and then nothing. I can sucessfully get into mysql from the command line, but only get a blank page and it stops at the PConnection function. I took a look at the php.ini file and see nothing wrong and copied from another working cacti server (same OS) and still the PConnect function never returns!!! Here is my code with the debug print statments, the PConnect does not return a 1 or a 0 it just hangs, it never prints Trying again count=:

function db_connect_real($host,$user,$pass,$db_name,$db_type, $port = "3306", $retries = 20) {
global $cnn_id;
echo "<P>Inside db_connect_read $hostport,$user,$pass,$db_name</P>";

$i = 0;
$cnn_id = NewADOConnection($db_type);

$hostport = $host . ":" . $port;

while ($i <= $retries) {
echo "<P>trying db connect $hostport,$user,$pass,$db_name</P>";
if ($cnn_id->PConnect($hostport,$user,$pass,$db_name)) {
echo "<P>Inside db_connect_read returning 1</P>";
return(1);
}

$i++;
echo "<P>trying again count=$i</P>";
usleep(40000);
}
print "<P>Could not connect to db</P>";
die("FATAL: Cannot connect to MySQL server on '$host'. Please make sure you have specified a valid MySQL database name in 'include/config.php'\n");
return(0);
}
greginmadison
Posts: 30
Joined: Fri Mar 07, 2008 8:58 am

Wrote a external program with same results

Post by greginmadison »

I even pulled out the code and rewrote and get the same results, the function PConnect is called but nothing prints as trying again or failing. I enable logging on my MySql server and never see the connect being accepted or denied:

<?php
include("/san/www/htdocs/cacti/lib/adodb/adodb.inc.php");
$host='localhost';
$user='cactiuser';
$pass='xxxx';
$db_name='cacti';
$db_type='mysql';
$port = "3306";
$retries = 2;

echo "<P>Inside db_connect_read $hostport,$user,$pass,$db_name</P>";

$i = 0;
$cnn_id = NewADOConnection($db_type);

$hostport = $host . ":" . $port;

while ($i <= 1) {
echo "<P>trying db connect $hostport,$user,$pass,$db_name</P>";
if ($cnn_id->PConnect($hostport,$user,$pass,$db_name)) {
echo "<P>Inside db_connect_read returning 1</P>";
}

$i++;
echo "<P>trying again count=$i</P>";
}
print "<P>Could not connect to db</P>";


?>
greginmadison
Posts: 30
Joined: Fri Mar 07, 2008 8:58 am

Found the problem PHP was installed without extensions

Post by greginmadison »

Found the problem PHP was installed without extensions gd, mysql, snmp, and zlib.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest