Hi,
I am new to PHP and Mysql development .
I had installed RHEL5 Server, Apache, PHP5 and MYSQL5.1.
I got below script which actually give status of the Apache, PHP and MYSQL.
<?php
session_start();
?>
<!--
INSTRUCTIONS:
1. Please copy this file anywhere in the DocumentRoot of your server.
2. Please change the mysql root user's password on line "mysql_connect".
3. Access this file through any browser.
-->
<html>
<body>
<?php
Session_register("S_test");
?>
Today is: <?
print date(d."/".m."/".Y) ?>
<table><tr><td bgcolor=#88aadd>
<b>
If you see current date above, it means that:<br>
1. Apache is UP<br>
2. PHP is UP<br>
</td></tr></table>
<br>
</b>
Now I will display mysql Users' List:<br>
<?
$sql="select Host, User from user";
$i=0;
# Change your password in the next line: its the 3rd parameter.
$Conn=mysql_connect("localhost","root","root");
$rs=mysql("mysql",$sql);
while ($i < mysql_num_rows($rs)) {
list($Host, $User)=mysql_fetch_row($rs);
print ":.........".$Host." .....:...... ".$User."<br>";
$i++;
}
$S_test="test";
print $S_test;
?>
<table><tr><td bgcolor=#88aadd>
<b>
If you see at least one line above like "....Host.....User", it means that:<br>
1. The mysql server is UP<br>
2. The mysql server is accessible through PHP<br>
<br>
If you see something like "<font color=red>Warning: MySQL Connection Failed: Access denied for user........</font>", please open myself (i.e. <?=$HTTP_SERVER_VARS["SCRIPT_FILENAME"];?>) and correct password in the function "mysql_connect" and run me again.
</td></tr></table>
When I try to view this it gives Apache and PHP up but it is not showing list of users as expected neither giving any error message.
When I try to connect to mysql using loging root and password root it get connected but through PHP it is not working.
Is there something which I have missed out?
Thanks in advance.