|
Posted by Al Dykes on 03/07/06 21:42
Is there a usenet group for Apache questions? If I knew of one I'd
post the question there.
I can't get a MySQL connection in PHP code under apache to work.
I'm learning LAMP, starting on a w2k box. I've downloaded recent
copies of Apache, MySQL and PHP and done the setup and it seems to
work,except for SQL. I can run pure PHP under the apache server and
I've installed phpmyadmin and I can make a database and then access it
from mysql in a cmd shell.
I suspect there is some configuration in Apache to talk to Mysql that
I've missed. There is no explicit mention of MySQL in my httpd.conf.
This code is my index.php file, generated from Dreamweaver8. When I
put it on my server and try to hit it from my browser (Firefox) it
just hangs and times out. Any other file (like index.htlm) works
fine, and a ling on index.html to index.php also hangs. All the
passwords, etc, work when tested from command line mysql.
I watch the Apache transaction log and see the client server activity.
There is none when I type to execute this code.
/Connections/apress.php is where it's supposed to be and the contents look fine.
It was generated by DW.
Thanks.
---index.php---
<?php virtual('/index.php/Connections/apress.php'); ?>
<?php
mysql_select_db($database_apress, $apress);
$query_rstCDS = "SELECT cd_name FROM cd";
$rstCDS = mysql_query($query_rstCDS, $apress) or die(mysql_error());
$row_rstCDS = mysql_fetch_assoc($rstCDS);
$totalRows_rstCDS = mysql_num_rows($rstCDS);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>My CD collection</title>
</head>
<body>
<p> </p>
<p>My CD COllection</p>
<p> </p>
<p><?php echo $totalRows_rstCDS ?> Records in our colleciton</p>
<p> </p>
</body>
</html>
<?php
mysql_free_result($rstCDS);
?>
--
a d y k e s @ p a n i x . c o m
Don't blame me. I voted for Gore.
Navigation:
[Reply to this message]
|