Results 1 to 2 of 2

Thread: php file giving 500 error

  1. #1
    Join Date
    Sep 2008
    Location
    Italy
    Beans
    96
    Distro
    Ubuntu Studio 12.04 Precise Pangolin

    php file giving 500 error

    I've been trying to make a wordpress theme from scratch, but when I open the index.php page in localhost I get an http 500 error.

    Apache is installed and configured correctly (Another site I have displays just fine).

    the only difference is that the index.php of the old site begins with an HTML declaration.

    header.php contains the proper declarations shouldn't this be enough?

    navigating to localhost/new_site/index.php gives 500 error:
    Code:
    <?php get_header(); ?>
        
    <div id="main">
      <div id="content">
        <h1>Main Area</h1>
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        <h1><?php the_title(); ?></h1>
        <h4>Posted on <?php the_time('F jS, Y') ?></h4>
        <p><?php the_content(__('(more...)')); ?></p>
        <hr>
        <?php endwhile; else: ?>
        <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
        <?php endif; ?>
      </div>
    
      <?php get_sidebar(); ?>
    
      </div>
    
    <div id="delimiter"></div>
    
    <?php get_footer(); ?>
    I've been trying to start this new site but am frustrated that right at stage 1 I can't even view the page correctly on my computer... any suggestions?

  2. #2
    Join Date
    Aug 2007
    Location
    Auckland, NZ
    Beans
    196
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: php file giving 500 error

    could be any number of reasons. I don't know what any of the functions do so I cant be certain.

    Firstly you need to check the log. Turn on error reporting by doing this,
    PHP Code:
    <?php 
    error_reporting
    (E_ALL);
    ?>
    It will most likely be here so you want to:

    sudo tail -n50 /var/log/apache2/error.log

    About 90% of the time PHP is getting fatal errors.

    Syntactically the code you posted seems ok. However I would use die('test'); through each bits of the code to see where the execution is failing, starting at the top going down once you have exhausted fixing the problems in the error log.
    Uses: Jaunty J 9.04 & Maverick 10.10

Tags for this Thread

Bookmarks

Posting Permissions

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