"Cannnot modify header information" PHP Error

You may encounter the following PHP error:
Warning: Cannot modify header information - headers already sent by (output started at)
This is typically caused by HTML being sent after PHP is already sent. If you have this issue on an application such as a forum, blog, or other managed CMS it may have happened because you accidentally added a space or other character at the very end or beginning of the PHP file, before or after the PHP tags <?php or ?>. Check the beginning and end of any recently modified files and ensure that no extra characters are added.

If you still have no luck, add the following PHP code to the very top and very bottom of your PHP script (e.g. in the header and footer PHP includes, if applicable)

At the top:

<?php ob_start(); ?>
and at the bottom:

<?php ob_end_flush(); ?>
This should prevent this error from appearing.
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How do I use Remote MySQL?

To use Remote MySQL, you can connect via any remote MySQL tool - like Navicat or HeidiSQL.You...

Why can't I upload files to my website (Wordpress themes, etc.)

If you are not able to upload large files to your website, this may be because of the default PHP...

What are the nameservers?

To get your domain working on Arch Hosting's servers, you'll have to point your domain's...

How to configure Cloudflare correctly to prevent DDoS & leaking the server IP

Keep in mind, parts of this guide are outdated and this guide is only being kept online for...

How to show hidden files in cPanel's File Manager

In your cPanel account, search for the 'File Manager' button under the 'Files' category. Once you...