473,386 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Hlep with w2k LAMP configuration, I think.


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>&nbsp;</p>
<p>My CD COllection</p>
<p>&nbsp;</p>
<p><?php echo $totalRows_rstCDS ?> Records in our colleciton</p>
<p>&nbsp;</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.
Mar 7 '06 #1
3 1714
Following on from Al Dykes's message. . .


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.


(1) Apache needs to know about php
(2) PHP needs to know about MySQL
From this analysis you can see that it is the php.ini file where you
should be looking. Version 5 needs MySQL enabling whereas version 4 was
enabled by default. (I can't give the details at the moment - look in
the V5 docs)

--
PETER FOX Not the same since the e-commerce business came to a .
pe******@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Mar 8 '06 #2
Al Dykes wrote:
Is there a usenet group for Apache questions? If I knew of one I'd
post the question there.

How about alt.apache.configuration?
I can't get a MySQL connection in PHP code under apache to work.

Not good. :-)
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.

Then MySQL and PHP ARE working together.
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.

You shouldn't need it in the httpd.conf file. Apache isn't accessing
MySQL - PHP is. But it does need to be in your php.ini file.
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.

Hmmm, that doesn't sound good :-) I watch the Apache transaction log and see the client server activity.
There is none when I type to execute this code.

What about the Apache error log? And your MySQL log? Anything there?

Also - did you actually connect to the host in your include file? Since
you didn't post it, we don't know.

If you can't find any errors, you may have to back up and do some
troubleshooting. Like comment out all the MySQL code except the call to
connect and try. If it works, add the db selection, and so on.
/Connections/apress.php is where it's supposed to be and the contents look fine.
It was generated by DW.

I never trust generated code. I use it, but not without examining it
very closely first. I've been burned too many times. Congratulations
for checking it!
Thanks.


<code snipped>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 8 '06 #3
In article <dY********************@comcast.com>,
Jerry Stuckle <js*******@attglobal.net> wrote:
Al Dykes wrote:
Is there a usenet group for Apache questions? If I knew of one I'd
post the question there.


How about alt.apache.configuration?
I can't get a MySQL connection in PHP code under apache to work.


Not good. :-)
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.


Then MySQL and PHP ARE working together.
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.


You shouldn't need it in the httpd.conf file. Apache isn't accessing
MySQL - PHP is. But it does need to be in your php.ini file.

Thanks for you comments. I've gutted the Dreamweaver code and reduced
the problem to textbook code;
<?php
@mysql_connect("localhost", "book2", "book2")
or die("Could not connect to MySQL server!");

@mysql_select_db("book2")
or die("Could not select database!");
?>

It works and I'm on to other problems. I'll deal with DW later. I'll
deal with dreamweaver later.
--
a d y k e s @ p a n i x . c o m

Don't blame me. I voted for Gore.
Mar 8 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Ranger West | last post by:
Hello there, Are there any out-of-the box handhelds that run Linux/Apache/MYSQL and PHP? Does Redhat, Suse, or Gentoo support any handhelds? I know the Zaurus comes close, but I've heard...
12
by: Google Mike | last post by:
You know, while working on my moonlight corporation's LAMP project at home this weekend, I couldn't help but wonder if people writing similar projects are solving similar problems with having to...
10
by: Zabby | last post by:
hi, i want to turn on/turn off a usb lamp via a vb.net button... i think i would have to turn on/turn off the power for this usb port.... how could i do this? kind regards
2
by: Yogee | last post by:
Hello all, I dont know the exact group where I should post my questions. So, I m doing it on most of the groups which support components of LAMP stack. My client wants to use WAMP ( Windows +...
21
by: joelbyrd | last post by:
I was looking at jobs on craigslist and saw several postings saying something like "2+ years experience developing for a LAMP (Linux/Apache/MySQL/PHP) platform...". Now, I've been working with PHP...
0
by: Sam | last post by:
Folks, I am new to ASP.Net 2.0. I do not know what I did with my configuration settings... Now when I drag and drop Sqldatasource from the toolbox, I can't see it in the design view. Even...
1
by: flash | last post by:
Need hlep to delete array only because all function is ok (inser, sort andsearch) #include <iostream.h> //functions prototype void Insert(int,int); void Delete(int,int); int...
39
by: Gilles Ganault | last post by:
Hello, I'm no LAMP expert, and a friend of mine is running a site which is a bit overloaded. Before upgrading, he'd like to make sure there's no easy way to improve efficiency. A couple of...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.