• Hi everyone,
    Here’s my issue. Apologizes in advance for the long post and thank you to whoever takes the time to read it. I installed WP in a folder called “blog”, and at first glance everything seemed to be fine: the first post was properly displaying. I copied the default theme to make my own, and took basically stripped it down to be very simple, taking out the tags, the author, and comments. It still looked fine in the browser when I applied my own theme.

    Then on my site’s index page, I tried to do a SSI to include it there:

    <?php include("https://example.com/blog/index.php"); ?>

    However when I viewed the index page, no blog appeared, and all the HTML after that snippet of PHP had disappeared in source code view.

    To try to figure out what the error was, I added this to blog/index.php:

    <?php
    ini_set('display_errors','1');
    ini_set('display_startup_errors','1');
    error_reporting (E_ALL);include('index.php');
    ?>

    And what I got was this error message repeating many many many times beneath the blog entry when I went to https://example.com/blog/index.php:

    Notice: Constant WP_USE_THEMES already defined in /home/myusername/public_html/blog/index.php on line 14

    And at the very bottom of the page, it says:

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 7680 bytes) in /home/myusername/public_html/blog/index.php on line 17

    For the record here’s what’s on /blog/index.php:

    <?php
    /**
     * 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('./wp-blog-header.php');
    
    ini_set('display_errors','1');
    ini_set('display_startup_errors','1');
    error_reporting (E_ALL);include('index.php');
    
    ?>

    And here’s what /mytheme/index.php says:

    <?php
    /**
     * @package WordPress
     * @subpackage MisforMonsters
     */
    get_header();
    ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <?php the_date('','<h2>','</h2>'); ?>
    
    <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    	 <h1 class="blogtitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    	<div class="meta"> <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
    
    	<div class="content">
    		<?php the_content(__('(more...)')); ?>
    	</div>
    
    </div>
    
    <?php// comments_template(); // Get wp-comments.php template //?>
    
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>
    
    <?php posts_nav_link(' — ', __('&laquo; Newer Posts'), __('Older Posts &raquo;')); ?>
    
    <?php get_footer(); ?>

    Anyone have any ideas about what’s going on? Thanks!
    -Katherine

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘error message: Constant WP_USE_THEMES already defined…’ is closed to new replies.