Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Pure VPN - Up to 27 Months
vgp
Updated:
Friday at 8:10 AM
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Jun 2, 2026
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
May 30, 2026
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Php help
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="isuru143" data-source="post: 11915071" data-attributes="member: 29853"><p>use ob_start at the begining of the page</p><p></p><p>like </p><p><?php</p><p>ob_start();</p><p>?></p><p></p><p></p><p>Output buffering is not supported on all servers. (Though most do). </p><p></p><p>To test if you have Output buffering support try this on a php page on your server::</p><p></p><p>[CODE]</p><p></p><p><?php</p><p></p><p>ob_start();</p><p></p><p>echo 'dummy content';</p><p></p><p>if (headers_sent() || !ob_get_length()) {</p><p> echo 'Your sever does not support output buffering';</p><p>} else {</p><p> echo 'Output buffering supported';</p><p> ob_clean();</p><p>}</p><p></p><p></p><p>?>[/CODE]</p><p></p><p>If your server does support output buffering, then it may be that the buffer is being dumped prematurely before you're sending your headers. This could be happening if you're using flush() or ob_flush() before you use header().</p><p></p><p>When you use the header() function, you should always check if headers have been sent or not... </p><p></p><p>Here's an example function to use in place of header():</p><p></p><p>[CODE]function safe_header($str) {</p><p> if (!headers_sent()) {</p><p> <strong class="highlight">header</strong>($str);</p><p> return true;</p><p> }</p><p> return false;</p><p>}[/CODE]</p><p></p><p>What way you get a return of false if the header could not be sent. </p><p></p><p>Example Use:</p><p></p><p>[CODE]if (safe_header('Location: login.php')) {</p><p> die;</p><p>} else {</p><p> echo '<script>location = 'login.php';</script>';</p><p> echo 'Please <a href="login.php">Login</a>';</p><p> die;</p><p>}[/CODE]</p><p></p><p>Note that if headers are already sent then you cannot send any more headers or you'll get the error you're getting. So instead you can send some content such as JS to try and redirect the page. If the user does not use JS, then you'll have to fallback to a link.</p></blockquote><p></p>
[QUOTE="isuru143, post: 11915071, member: 29853"] use ob_start at the begining of the page like <?php ob_start(); ?> Output buffering is not supported on all servers. (Though most do). To test if you have Output buffering support try this on a php page on your server:: [CODE] <?php ob_start(); echo 'dummy content'; if (headers_sent() || !ob_get_length()) { echo 'Your sever does not support output buffering'; } else { echo 'Output buffering supported'; ob_clean(); } ?>[/CODE] If your server does support output buffering, then it may be that the buffer is being dumped prematurely before you're sending your headers. This could be happening if you're using flush() or ob_flush() before you use header(). When you use the header() function, you should always check if headers have been sent or not... Here's an example function to use in place of header(): [CODE]function safe_header($str) { if (!headers_sent()) { <strong class="highlight">header</strong>($str); return true; } return false; }[/CODE] What way you get a return of false if the header could not be sent. Example Use: [CODE]if (safe_header('Location: login.php')) { die; } else { echo '<script>location = 'login.php';</script>'; echo 'Please <a href="login.php">Login</a>'; die; }[/CODE] Note that if headers are already sent then you cannot send any more headers or you'll get the error you're getting. So instead you can send some content such as JS to try and redirect the page. If the user does not use JS, then you'll have to fallback to a link. [/QUOTE]
Insert quotes…
Verification
Dawasata paya keeyak thibeda?
Post reply
Top
Bottom