I have an application that was running very well. the server started malfunction and I had it reinstall with red5.2. it has mysql and php. but when i run the php program,the error
Connection failed: Couldn’t make the connection to localhost.
I would guess that this message is from your application, and likely related to the database. Check to see if the mysql(i) extension is available/enabled in your PHP installation.
<?php
$dbserver= "localhost"; // Hostname of your MySQL server
$db = "simrep"; // Name of your MySQL database
$dbuser = "root"; // MySQL user with access to $db
$dbpassword = "passwd"; // Password for MySQL user
/* Connect to the MySQL server */
$link = @mysql_connect ($dbserver, $dbuser, $dbpassword);
if (!$link){
echo ( "Unable to connect to db" );
exit();
}
/* Select the database */
if (!mysql_select_db ($db, $link) ){
exit ();
}
else{
echo ( "Able to connect to db<br>" );
$s="select * from sessions";
$q=mysql_query($s) or die(mysql_error());
while($r=mysql_fetch_array($q))
echo $r[2]."<br>";
}
?>
is outputing nothing when i have data in the database. strange, it was working initially. No error message
<?php
error_reporting(-1);
ini_set('display_errors', true);
$dbserver= "localhost"; // Hostname of your MySQL server
$db = "simrep"; // Name of your MySQL database
$dbuser = "root"; // MySQL user with access to $db
$dbpassword = "passwd"; // Password for MySQL user
/* Connect to the MySQL server */
$link = mysql_connect($dbserver, $dbuser, $dbpassword);
if(!$link){
echo 'Unable to connect to server: ' . mysql_error();
exit;
}
/* Select the database */
if(!mysql_select_db ($db, $link) ){
echo 'Cannot select database: ' . mysql_error();
exit;
}else{
$s = "select * from sessions";
$q = mysql_query($s) or die(mysql_error());
while($r = mysql_fetch_array($q)){
echo $r[2] . '<br>';
}
}
?>
Loading “security” plugin
Loading “rhnplugin” plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
No package php-mysql available.
Nothing to do