...

View Full Version : PHP, Localhost and Apache 2.0



jakenoble
06-05-2005, 10:15 PM
Hi all.

I have got this to work before but I cannot at the moment, I have just wiped my hdd.
I have installed Aphache 2.0 using Apache Triad, if I go to
EDIT: "http://localhost/file.php then it the page appears completely blank"

But if I go to .htm file it works fine, is there a serive thats not running?

Thanks
Jake

Kid Charming
06-05-2005, 11:06 PM
Make sure you've got this line in your httpd.conf:

AddType application/x-httpd-php .php

jakenoble
06-06-2005, 12:19 AM
Thanks kid charming, I just checked, and its present. Any other suggestions

Kid Charming
06-06-2005, 12:43 AM
Are you sure you've got a file.php in your document root? Do you have any other .php files you've tried?

jakenoble
06-06-2005, 12:54 AM
Hi kid charming

I have just noticed an error on my part, that if i got to php file then it just displays nothing, just white space. The code exists in the php file, but if i go to view source code for that page all its got is:

<html><body></body></html>
The page exists and the browser is pointing to the right location because htm files in the same folders as php files work.

Jake

Kid Charming
06-06-2005, 12:59 AM
What's the code in the file that's not working?

jakenoble
06-06-2005, 11:11 AM
Thats odd, the following code works,


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
Test page for PHP
</body>
</html>


But this page does not


<?php require_once('../../Connections/jakenoblewuk.php'); ?>
<?php
mysql_select_db($database_jakenoblewuk, $jakenoblewuk);
$query_blog = "SELECT blog.name, blog.pri_key, blog.blog, date_format(time,'%e/%c/%Y %H:%i:%s ') AS timestamp FROM blog ORDER BY blog.`time` desc";
$blog = mysql_query($query_blog, $jakenoblewuk) or die(mysql_error());
$row_blog = mysql_fetch_assoc($blog);
$totalRows_blog = mysql_num_rows($blog);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Our Blog</title>
<link href="jakelancs_blog.css" rel="stylesheet" type="text/css">
</head>
<body>
<table align="center" width="100%" border="0">
<tr>
<td></td>
<td align="center" width="600px">
<p><img src="../images/blog_logo.gif"></p>
<h1>Floor B's Blog!</h1></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><table border="0" align="center">
<tr>
<td align="center" class="menu">| <a href="add_blog.php">Add a new Blog</a> | <a href="uni_index.php">Home</a>
| <a href="photos.htm">Photos</a> | <a href="http://www.lancaster.ac.uk">Uni
Site</a> | <a href="http://www.jakenoblewebs.co.uk">Jake's Site</a> | </td>
</tr>
</table></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>

<p>
<table width="100%" border="0" cellpadding="5" cellspacing="5" class="blogs">
<tr>
<td class="blog_border" width="75px">Blog No.</td>
<td class="blog_border" width="120px">Time</td>
<td class="blog_border" width="130px">Name</td>
<td class="blog_border" width="500px">Blog</td>
</tr>
<?php do { ?>
<tr>
<td class="blogs_font"><?php echo $row_blog['pri_key']; ?></td>
<td class="blogs_font"><?php echo $row_blog['timestamp']; ?></td>
<td class="blogs_font"><?php echo $row_blog['name']; ?></td>
<td align="center" class="blogs_font"><?php echo $row_blog['blog']; ?></td>
</tr>
<?php } while ($row_blog = mysql_fetch_assoc($blog)); ?>
</table>
</td>
<td>&nbsp;</td>
</tr>
</table>
</p>

</body>
</html>
<?php
mysql_free_result($blog);
?>


Is this because the one that does not work implements a mysql database? There is obviously something wrong with that.

Jake

jakenoble
06-06-2005, 11:54 AM
Fixed it, I hadn't actually started the MySQL server, silly me.

Thanks anyway Kid Charming.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum