SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Web Enthusiast
    Join Date
    Jul 2000
    Location
    Western Massachusetts, USA
    Posts
    1,383
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    plugable.php error message

    The website www.tritownrotary.org is throwing the error message:
    Warning: Cannot modify header information - headers already sent by (output started at /home/tritown1/public_html/index.php(1) : eval()'d code:7) in /home/tritown1/public_html/wp-includes/pluggable.php on line 866
    I have tried debugging the site by renaming all the plugins and themes via FTP, which doesn't change the message. I have also commented out the function of which line 866 is a part. That changes the message to say the function is not found, but the site is still not available. Has anyone else come across this problem and gotten to the root of the problem? I'd appreciate some help.
    Paul C.
    ClickBasics
    http://www.clickbasics.com

  2. #2
    Web Enthusiast
    Join Date
    Jul 2000
    Location
    Western Massachusetts, USA
    Posts
    1,383
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh yes. The offending line is the third from the end in:
    Code:
    if ( !function_exists('wp_redirect') ) :
    /**
     * Redirects to another page.
     *
     * @since 1.5.1
     * @uses apply_filters() Calls 'wp_redirect' hook on $location and $status.
     *
     * @param string $location The path to redirect to
     * @param int $status Status code to use
     * @return bool False if $location is not set
     */
    wp_redirect($location, $status = 302) {
        global $is_IIS;
    
        $location = apply_filters('wp_redirect', $location, $status);
        $status = apply_filters('wp_redirect_status', $status, $location);
    
        if ( !$location ) // allows the wp_redirect filter to cancel a redirect
            return false;
    
        $location = wp_sanitize_redirect($location);
    
        if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' )
            status_header($status); // This causes problems on IIS and some FastCGI setups
    
        header("Location: $location", true, $status);
    }
    endif;
    Paul C.
    ClickBasics
    http://www.clickbasics.com

  3. #3
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    There must not be any output data when header() is called; otherwise you will get error messages such as one you reported.

    I suspect your
    if ( !function_exists('wp_redirect') )
    should be
    if ( function_exists('wp_redirect') )

  4. #4
    Web Enthusiast
    Join Date
    Jul 2000
    Location
    Western Massachusetts, USA
    Posts
    1,383
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I made that change. Now I get the error message
    Parse error: syntax error, unexpected '{' in /home/tritown1/public_html/wp-includes/pluggable.php on line 852
    where line 852 is
    Code:
    wp_redirect($location, $status = 302) {
    Paul C.
    ClickBasics
    http://www.clickbasics.com

  5. #5
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Your function wp_redirect() should be among your functions list (pluggable.php)
    example:
    PHP Code:
    <?php
       
    function wp_redirect($location$status 302)
       {
           global 
    $is_IIS;
           
    $location apply_filters('wp_redirect'$location$status);
           
    $status apply_filters('wp_redirect_status'$status$location);
           if ( !
    $location // allows the wp_redirect filter to cancel a redirect
               
    return false;
           
    $location wp_sanitize_redirect($location);
           if ( !
    $is_IIS && php_sapi_name() != 'cgi-fcgi' )
               
    status_header($status); // This causes problems on IIS and some FastCGI setups
           
    header("Location: $location");
       }

       function 
    apply_filters($var1$var2$var3)
       {
           
    // your code ...
           
    return $var2;
       }

       function 
    wp_sanitize_redirect($var1)
       {
           
    // your code ...
           
    return $var1;
       }
       
       function 
    status_header($var1)
       {
           
    // your code ...
       
    }
    ?>
    And your script should now be something like this:
    PHP Code:
    <?php
    include ('pluggable.php');

    if ( 
    function_exists('wp_redirect') )
    {
        
    wp_redirect('test.html');
    }
    else
        echo 
    "function wp_redirect not found!";
    ?>

  6. #6
    Web Enthusiast
    Join Date
    Jul 2000
    Location
    Western Massachusetts, USA
    Posts
    1,383
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wordpress error message

    I just got this new error message at www.tritownrotary.org.

    Warning: Cannot modify header information - headers already sent by (output started at /home/tritown1/public_html/index.php(1) : eval()'d code:4) in /home/tritown1/public_html/wp-includes/pluggable.php on line 866
    I made no changes to cause this. Anyone have a clue as to why it suddenly appeared and how to fix it?
    Paul C.
    ClickBasics
    http://www.clickbasics.com


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
  •