• Resolved AinsleyKB

    (@ainsleykb)


    I haven’t touched one of my websites in a couple of months, but when I tried to login today, the website gave me these errors:

    Warning: Cannot modify header information – headers already sent by (output started at /home/tpcfbr/public_html/wp-settings.php:1) in /home/tpcfbr/public_html/wp-login.php on line 431

    Warning: Cannot modify header information – headers already sent by (output started at /home/tpcfbr/public_html/wp-settings.php:1) in /home/tpcfbr/public_html/wp-login.php on line 444

    Warning: Cannot modify header information – headers already sent by (output started at /home/tpcfbr/public_html/wp-settings.php:1) in /home/tpcfbr/public_html/wp-content/plugins/wpclef/includes/lib/wp-session/class-wp-session.php on line 124

    Warning: Cannot modify header information – headers already sent by (output started at /home/tpcfbr/public_html/wp-settings.php:1) in /home/tpcfbr/public_html/wp-includes/pluggable.php on line 935

    Warning: Cannot modify header information – headers already sent by (output started at /home/tpcfbr/public_html/wp-settings.php:1) in /home/tpcfbr/public_html/wp-includes/pluggable.php on line 936

    Warning: Cannot modify header information – headers already sent by (output started at /home/tpcfbr/public_html/wp-settings.php:1) in /home/tpcfbr/public_html/wp-includes/pluggable.php on line 937

    Does anyone have any ideas what would cause this? I’ve typed the code up to show what is on those specific lines.

    Lines 425-446:

    // validate action so as to default to the login screen
    if ( !in_array( $action, array( 'postpass', 'logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login' ), true ) && false === has_filter( 'login_form_' . $action ) )
    	$action = 'login';
    
    nocache_headers();
    
    header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset'));
    
    if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set
    	if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) )
    		$_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] );
    
    	$url = dirname( set_url_scheme( 'https://' .  $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) );
    	if ( $url != get_option( 'siteurl' ) )
    		update_option( 'siteurl', $url );
    }
    
    //Set a cookie now to see if they are supported by the browser.
    $secure = ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) && 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
    setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure );
    if ( SITECOOKIEPATH != COOKIEPATH )
    	setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );

    Lines 120-125:

    /**
         * Set the session cookie
         */
        protected function set_cookie() {
            setcookie( WP_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant , $this->expires, COOKIEPATH, COOKIE_DOMAIN );
        }

    Lines 921-943:

    /**
    	 * Fires immediately before the secure authentication cookie is set.
    	 *
    	 * @since 2.6.0
    	 *
    	 * @param string $logged_in_cookie The logged-in cookie.
    	 * @param int    $expire           Login grace period in seconds. Default 43,200 seconds, or 12 hours.
    	 * @param int    $expiration       Duration in seconds the authentication cookie should be valid.
    	 *                                 Default 1,209,600 seconds, or 14 days.
    	 * @param int    $user_id          User ID.
    	 * @param string $scheme           Authentication scheme. Default 'logged_in'.
    	 */
    	do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in' );
    
    	setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
    	setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
    	setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
    	if ( COOKIEPATH != SITECOOKIEPATH )
    		setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
    }
    endif;
    
    if ( !function_exists('wp_clear_auth_cookie') ) :

Viewing 2 replies - 1 through 2 (of 2 total)
  • MagikCommerce

    (@magikcommerce)

    It is usually because there are spaces, new lines, or other stuff before an opening <?php tag or after a closing ?> tag.
    Please remove whitespace from wp-settings.php file .

    Have a look over below thread –
    https://codex.www.ads-software.com/FAQ_Troubleshooting

    Hope this will help you.

    Thread Starter AinsleyKB

    (@ainsleykb)

    Thanks so much! It worked!

    After fixing the wp-settings.php file, it gave the same error with a different page. So I did the same. In total, there were 6 files I had to go through, but it let me login after I fixed each of them.

    Again, thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Website Login Warnings’ is closed to new replies.