“headers already sent” PHP Error

In some cases we find the following error from Apache logs:

PHP Warning: Cannot modify header information – headers already sent by

We can fix this error by updating a  php.ini file.

Find the domain’s php.ini file. If there is no php.ini file, you have to create one.

Open the file and locate the line:

output_buffering = Off

Change the line as follows:

output_buffering = On

Also, increase “maximum_execution_time” to 300.

Save the php.ini file and restart Apache service.

After making this change, issue will be fixed and your website will be back online.