简体   繁体   中英

Warning: Cannot modify header information - headers already sent by

Hi there I have seen similar problems on the net about this issue but the resolutions I have tried have not worked.

i'm developing a word-press site for a client I have done this before without issue. However, this time when I uploaded the template to my test server for the clients viewing I encountered these errors.

Warning: Cannot modify header information - headers already sent by (output started at /homepages/0/d682858018/htdocs/clickandbuilds/test/wp-includes/option.php:1) in /homepages/0/d682858018/htdocs/clickandbuilds/test/wp-includes/option.php on line 808

Warning: Cannot modify header information - headers already sent by (output started at /homepages/0/d682858018/htdocs/clickandbuilds/test/wp-includes/option.php:1) in /homepages/0/d682858018/htdocs/clickandbuilds/test/wp-includes/option.php on line 809

I have gone to the file and the lines it is referring to are ;

    // The cookie is not set in the current browser or the saved value is newer.
$secure = ( 'https' === parse_url( admin_url(), PHP_URL_SCHEME ) );
setcookie( 'wp-settings-' . $user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure );
setcookie( 'wp-settings-time-' . $user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure );
$_COOKIE['wp-settings-' . $user_id] = $settings;

Would appreciate some guidance as to what is causing the error and how to fix it.

Things I have tried;

  • *eliminating white space
  • *removing ?>
  • *combing through code in function.php and removing whitespace.
  • *reinstalling wordpress.

Some people have marked this question as similar to another question but as I have mentioned this is different it's something to do with the template. It works fine locally

尝试通过文件管理器上传模板,然后在wp-admin中将其激活。

Found the issue when I actually viewed the code in a separate editor it highlighter a space before the opening

Thanks for everyones comments.

for me this error was in my Prestashop site(v 1.6.0.6) homepage and solved by lowering site php version from 5.6 to 5.3 in cpanel => MultiPHP Manager section.

so if you prefer more detail and manual editing, check .htaccess file and add following line to it

AddHandler application/x-httpd-php53.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM