We used to get below error when using header() in our php code.
Warning: Cannot modify header information - headers already sent by (output started at...
The reason/root cause for this warning is due the fact "No other information can be sent to the server before the Header".
This "headers already sent" error is usually caused by having white space before or after the opening and closing PHP tags (<?php . . . ?>).
So, remove any white space before or after these tags.
If you still get this error even after removing white space, you need to check whether you put echo of any text before using header().
Use of ob_start() at start of the code may resolve this issue.
More Articles...
Wednesday, September 9, 2009
Handling "headers already sent" Error
Related Posts
- Difference between creating objects in PHP and Python
- Sample PHP code for using Google Gemini API
- PHP developer Career opportunities suggested by Gemini
- Challenges in Developing and Testing PHP Script for Automatic Resume Submission
- PHP Code to have different number of rows in first page of PDF file generated by FPDF Library
Search This Blog

AI Course | Bundle Offer | Unlocking AI | Dream Big | Listen to Dream Big
Today's Deals | Timesheet | Products | SQL ebook | Earn 50% commission
About | Privacy | Follow | TOS | WhatsApp | Contact
I may earn a commission from Amazon affiliate links
No comments:
Post a Comment