Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Feb 2004
    Location
    UK, derby
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP, Localhost and Apache 2.0

    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
    Last edited by jakenoble; 06-06-2005 at 12:55 AM.

  • #2
    Regular Coder
    Join Date
    Jun 2005
    Posts
    804
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Make sure you've got this line in your httpd.conf:

    AddType application/x-httpd-php .php

  • #3
    Regular Coder
    Join Date
    Feb 2004
    Location
    UK, derby
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks kid charming, I just checked, and its present. Any other suggestions

  • #4
    Regular Coder
    Join Date
    Jun 2005
    Posts
    804
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Are you sure you've got a file.php in your document root? Do you have any other .php files you've tried?

  • #5
    Regular Coder
    Join Date
    Feb 2004
    Location
    UK, derby
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:
    Code:
    <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

  • #6
    Regular Coder
    Join Date
    Jun 2005
    Posts
    804
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What's the code in the file that's not working?

  • #7
    Regular Coder
    Join Date
    Feb 2004
    Location
    UK, derby
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thats odd, the following code works,
    Code:
    <!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
    Code:
    <?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

  • #8
    Regular Coder
    Join Date
    Feb 2004
    Location
    UK, derby
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Fixed it, I hadn't actually started the MySQL server, silly me.

    Thanks anyway Kid Charming.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •