Saturday, July 24, 2010
Annoying PHP warning - Cannot modify header information
All of sudden I got below error -
"Warning: Cannot modify header information - headers already sent by (output started at XXXXXX.php:23) in XXXXXX.php on line 143"
WTH!
Then searched online and found out that you should not have white spaces or blank lines before "?php", and after "?". Did that, still got the same error.
Do more researching..., and found out this - In the PHP.ini file, you need to turn on the buffer.
"output_buffering = On"
After I updated the this PHP.ini file, this annoying error is finally gone now.
"Warning: Cannot modify header information - headers already sent by (output started at XXXXXX.php:23) in XXXXXX.php on line 143"
WTH!
Then searched online and found out that you should not have white spaces or blank lines before "?php", and after "?". Did that, still got the same error.
Do more researching..., and found out this - In the PHP.ini file, you need to turn on the buffer.
"output_buffering = On"
After I updated the this PHP.ini file, this annoying error is finally gone now.
Sunday, July 11, 2010
Silverlight navigation - open a pop-up screen
Some useful code: Navigate to the next page in a pop-up window in Silverlight 3, if pop-up is allowed. If not allowed, navigate to it in the same window.
"HtmlPopupWindowOptions options = new HtmlPopupWindowOptions();
options.Left = 0;
options.Top = 0;
options.Width = 600;
options.Height = 400;
if (true == HtmlPage.IsPopupWindowAllowed)
{
HtmlPage.PopupWindow(new Uri("http://www.yahoo.com"), "new", options);
}
else //if pop up not allowed, to render it in the same page
{
HtmlPage.Window.Navigate(new Uri("http://www.yahoo.com", UriKind.Absolute));
}"
"HtmlPopupWindowOptions options = new HtmlPopupWindowOptions();
options.Left = 0;
options.Top = 0;
options.Width = 600;
options.Height = 400;
if (true == HtmlPage.IsPopupWindowAllowed)
{
HtmlPage.PopupWindow(new Uri("http://www.yahoo.com"), "new", options);
}
else //if pop up not allowed, to render it in the same page
{
HtmlPage.Window.Navigate(new Uri("http://www.yahoo.com", UriKind.Absolute));
}"
Sunday, July 4, 2010
PHP Trouble-Shooting and Self References
Session Warning
Problem: Start getting session warning today - "Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/dbconnect.php:10) ..."
Solution: To fix this issue, I had to move "session_start();" to the begining of the page. Then it all started working fine. This was not an issue before. I read from some posts that if you are using cookie based session, you need to call this statement before anything else. Anyway, log this for future reference, in case I forget about it, as I always do. ;)
Problem: Start getting session warning today - "Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/dbconnect.php:10) ..."
Solution: To fix this issue, I had to move "session_start();" to the begining of the page. Then it all started working fine. This was not an issue before. I read from some posts that if you are using cookie based session, you need to call this statement before anything else. Anyway, log this for future reference, in case I forget about it, as I always do. ;)
Subscribe to:
Comments (Atom)
