Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Catherine Millington
Catherine Millington
3,754 Points

Can't load XAMPP in browser

When i type in localhost in chrome, it comes up with the following message. Am i missing something? XAMPP is running in the background.

This web page is not available

ERR_CONNECTION_REFUSED Hide details Google Chrome's connection attempt to localhost was rejected. The website may be down or your network may not be properly configured.

Catherine Millington
Catherine Millington
3,754 Points

Here's the code for my index in the template folder

<?php get_header(); ?>

<section class="row">
      <div class="small-12 columns text-center">
        <div class="leader">



<?php if ( have_posts() ) : while (have_posts() ) : the_post(); ?>


    <h1><?php the_title(); ?></h1>
    <p><?php the_content(); ?></p>

<?php endwhile; else : ?>

    <p><?php _e('Sorry, no pages found.', 'treehouse-portfolio'); ?></p>

<?php endif; ?>

<!-- End of The Loop -->

        </div>
      </div>
    </section>




<?php get_footer(); ?>
Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

Any change?

If you're sure your connections to localhost and mysql are open Try deleting the closing html tags in the code. I'm afraid can't be more helpful than that at this point though. :(

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

You just need to switch on Apache using your Xampp control panel.

You'll likely have a shortcut to the control panel on your desktop. Sometimes just activating the control panel will switch on localhost.

But if not, clicking "Start" next to Apache will do the trick.

Apache covers localhost, but if you need to work with WordPress locally you'll need to do the same for mySQL.

Good luck :)

Catherine Millington
Catherine Millington
3,754 Points

Thanks. It seems as though it needed the port after it in the browser localhost:1234 which i saw when i went to the admin button on APACHE. Thanks for directing me that way!

Catherine Millington
Catherine Millington
3,754 Points

Sorry it won't work because i think there is a problem with the localwp.com directory. It says it has an error;

This web page is not available

ERR_CONNECTION_REFUSED

Could it be the index file?

/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

Hmmm. Is there an index file in your themes folder for the theme you're working on. Because i think this is where WordPress will look first to display content.

This is some code you might be able to use to get it working. It contains a copy of the basic WordPress loop. Even if there's no posts to display it should display a message at least.

<?php get_header(); ?>

        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
            <h1><?php the_title(); ?></h1>
            <p><?php the_content(); ?></p>   

        <?php endwhile; else : ?>
            <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
        <?php endif; ?>           

    </section>

<?php get_footer(); ?>
Catherine Millington
Catherine Millington
3,754 Points

I've used your index code instead of mine but still not luck. Don't worry, i'll keep digging. Thanks!