hi. i have debian 2.2, kernel-2.2.17 with 128MB ram and 6GB hd (lots of
free space). wanting to install LAMP the debian way, i did the ff:
apt-get install apache mysql-server mysql-client
tested the installation by doing "lynx http://localhost/" which shows
the usual gnu and penguin graphic. i still don't know how to test mysql
from apache though.
so afterwards i did an "apt-get install php4", added:
LoadModule php4_module /usr/lib/apache/1.3/libphp4.so
in /etc/apache/httpd.conf and i also did add:
AddType application/x-httpd-php4 .php4
in /etc/apache/srm.conf so that php4 will work with apache.
now the problem is my test2.php file won't connect to mysql database i
created manually. it gives an "the connection was refused when
attempting to contact localhost". i went thru the php3-doc (the only
available doc for the php4.deb package) and i can't get any more info on
why it won't connect. to be sure that the password is right i login to
mysql from the shell (mysql -u root -p) and i was able to connect/login.
what am i missing here? attached below is my test2.php
<html>
<head>
<title>Example 2 -- more details</title>
</head>
<body bgcolor="white">
<?
$dbuser='root';
$dbhost='localhost';
$dbpass='password';
$dbname='test2';
$dbtable='books';
//---------- DATABASE CONNECTION ------------//
$mysql_link = mysql_connect ($dbhost,$dbuser,$dbpass) or die ("Could not connect");
$column = mysql_list_fields($dbname,$dbtable,$mysql_link);
$sql = "select * from $dbtable";
$result = mysql_db_query($dbname,$sql);
?>
<table bgcolor="black">
<tr><td>
<table><!---- Inside Table ---->
<?
while($value = mysql_fetch_array($result))
{
print "<tr BGCOLOR=YELLOW>";
//This loop goes through the columns and prints
//each value
for ($i=0; $i < mysql_num_fields($column); $i++)
{
print "<td> $value[$i] </td>";
}
print "</tr>";
}
mysql_free_result($result);
mysql_close();
?>
</table><!---- Inside Table ---->
</td></tr>
</table>
</body>
</html>
--
--------------------------------------------------------------------
Key fingerprint = 9DE1 5825 77B4 FF45 7485 D3EB DCCF DE48 09B6 4426
--------------------------------------------------------------------
"Who's watching the watchmen?"
Attachment:
pgpYlHoTZbWsD.pgp
Description: PGP signature