PHP Warning: Cannot modify header information – headers already sent

It’s a common issue on the sites, PHP Warning: Cannot modify header information – headers already sent, Your site turn to a white page.  It occurs because of output_buffering is disabled in your PHP.

Step 1. Log in to the server via SSH

Step 2. You can see your sites PHP information by putting an info.php

Create an info.php under your domain’s document root

vim info.php

<?php phpinfo(); ?>

Save the file.

Step 3. Set the permission for the info.php. For this, now call your domain.com/info.php you could see the PHP settings, then locate the domain’s php.ini location from the info.php

Eg: /opt/cpanel/ea-php56/root/etc/php.ini

It looks like the above-mentioned location.

In that php.ini enable the output_buffering

output_buffering = 1

Save the php.ini.

Step 4. Restart the httpd

service httpd restart

Now check the site after clearing your browser cache. It should be working fine. 

Was this answer helpful? 0 Users Found This Useful (0 Votes)