Forums

Warning: Cannot modify header information - headers already sent by (6 posts)

  1. awev
    Member
    Posted 5 months ago #

    Hello folks,
    I created a new site, on a new domain, and used the auto-install feature from my cPanel form the hosting company. It installed 2.71, and I used the auto-upgrade feature to update WP to 2.8 before doing anything else. I have installed a couple plug-ins before doing anything, even before selecting a template to use.

    When I go to edit the default Hello World message, or create a new post, I get the follow error:

    Warning: Cannot modify header information - headers already sent by (output started at /home/fitness/public_html/wp-includes/class.wp-scripts.php:123) in /home/fitness/public_html/wp-includes/classes.php on line 1586

    The above is from trying to create a new post, and yet I get pretty much the same message when trying to do anything else, such as edit my profile. It is the second ../wp-includes/*.php that changes when doing something else, reflecting what I am trying to do.

    Any help is much appreciated - even if it is to point me to the reported bugs section.

  2. esmi
    Member
    Posted 5 months ago #

  3. awev
    Member
    Posted 5 months ago #

    Hello folks,
    Esmi, thanks for the links - that was the first thing I though of, yet it doesn't seem to apply - well, it might, as we seem to be generating part of a header with the echo function command to tell the browser that it is a javascript script, yet it doesn't seem to use the refresh/redirect techniques that I have come to expect.

    Here is the function, and the code for line 123, as suggested by the error message, and esmi's links, it is the finial else test, where the line being executed is echo "<script ...

    function do_item( $handle, $group = false ) {
    		if ( !parent::do_item($handle) )
    			return false;
    
    		if ( 0 === $group && $this->groups[$handle] > 0 ) {
    			$this->in_footer[] = $handle;
    			return false;
    		}
    
    		if ( false === $group && in_array($handle, $this->in_footer, true) )
    			$this->in_footer = array_diff( $this->in_footer, (array) $handle );
    
    		$ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
    		if ( isset($this->args[$handle]) )
    			$ver .= '&' . $this->args[$handle];
    
    		$src = $this->registered[$handle]->src;
    
    		if ( $this->do_concat ) {
    			$srce = apply_filters( 'script_loader_src', $src, $handle );
    			if ( $this->in_default_dir($srce) ) {
    				$this->print_code .= $this->print_scripts_l10n( $handle, false );
    				$this->concat .= "$handle,";
    				$this->concat_version .= "$handle$ver";
    				return true;
    			} else {
    				$this->ext_handles .= "$handle,";
    				$this->ext_version .= "$handle$ver";
    			}
    		}
    
    		$this->print_scripts_l10n( $handle );
    		if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
    			$src = $this->base_url . $src;
    		}
    
    		$src = add_query_arg('ver', $ver, $src);
    		$src = esc_url(apply_filters( 'script_loader_src', $src, $handle ));
    
    		if ( $this->do_concat )
    			$this->print_html .= "<script type='text/javascript' src='$src'></script>\n";
    		else
    			<strong>echo "<script type='text/javascript' src='$src'></script>\n";</strong>
    
    		return true;
    	}

    Thanks again folks for taking a look

  4. awev
    Member
    Posted 5 months ago #

    Sorry folks,
    I tried to make the line in question pop by making it strong/bold, yet it doesn't seem to work in the code section. Just ignore the tags.

  5. azaozz
    Member
    Posted 5 months ago #

    The function do_item() is called in the HTML head section to output the <script ... > tags. It seems something is calling it before that. Did you try disabling the plugins and using the default theme?

  6. awev
    Member
    Posted 5 months ago #

    It is to the point where I think I am going to have to start over. When I try going to the home page of my site I only see the error message, nothing else. When I go to mysite/wp-login.php I get the error message, yet it displays the log-in screen. When I type in my user name and password it tells me that I need cookies enabled - I have those enabled for all but third-party sites.

    Oh well, some things just where not meant to be. I think this time I'll do the install myself, and not use cPanel, so I know that I am using version 2.8 without it having to update itself from 2.7.1.

    Thanks Azaozz for the idea - wishing I was able to test it.

Reply

You must log in to post.

About this Topic