Zend_Session_Exception: Session must be started before any output has been sent to the browser; output started in

1,847 views
Skip to first unread message

Randell

unread,
Sep 9, 2010, 3:13:17 AM9/9/10
to zfdeve...@googlegroups.com
Hi guys,

I have been getting this error from a project using Zend Framework:

Zend_Session_Exception: Session must be started before any output has been sent to the browser; output started in...

Any clues on where I should look at?


Thanks in advance!
--
Randell

J Mac

unread,
Oct 6, 2010, 4:46:29 PM10/6/10
to Zend Framework Developers
Have you initialized your session correctly? Have you started it
using Zend_Session::start()?

Joseph Melnick

unread,
Oct 6, 2010, 5:09:17 PM10/6/10
to zfdeve...@googlegroups.com
Hello Randell,

This error often occurs often occurs when there is whitespace present after a closing php tag.

It may be that the folder used to store sessions is not setup correctly and the application is throwing an error which is in turn causing your session to fail.


Joseph Melnick
JM Web Consultants
joseph....@gmail.com



--
You received this message because you are subscribed to the Google Groups "Zend Framework Developers" group.
To post to this group, send email to zfdeve...@googlegroups.com.
To unsubscribe from this group, send email to zfdevelopers...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/zfdevelopers?hl=en.


Daniel de Matos Lima

unread,
Oct 6, 2010, 5:11:05 PM10/6/10
to zfdeve...@googlegroups.com
Hi Joseph,

Are you modifying any http header information before starting session or writing something on the page ?


--
Daniel de Matos Lima


2010/9/9 Randell <josephrande...@gmail.com>
--

Joseph Melnick

unread,
Oct 6, 2010, 5:21:56 PM10/6/10
to zfdeve...@googlegroups.com
Hi Daniel,

I am trying to help Randell with his session problems.

Having him look at whether he is modifying any header information before starting his session may lead him to the root cause of his problem.

Joseph Melnick

tawfek daghistani

unread,
Oct 6, 2010, 5:23:30 PM10/6/10
to zfdeve...@googlegroups.com
I guess you have a space some where outside of php blocks 
check index.php , bootstrap.php
or some where else 

Randell

unread,
Oct 6, 2010, 9:39:08 PM10/6/10
to zfdeve...@googlegroups.com
Hi guys,

Just an update: in my case, the error was cause by deprecated code in PHP 5.3.*. I got the project from a PHP 5.2.9 instance so I didn't get the problem from that other server. The solution was to either use PHP 5.2.9 as well with the same php.ini or modify the error_reporting variable of php.ini to not report warnings or errors coming from deprecated code.
Cheers,
--
Randell Benavidez

Manish Khanchandani

unread,
Oct 6, 2010, 10:38:53 PM10/6/10
to zfdeve...@googlegroups.com, naveenkha...@gmail.com
Hi,
changing error_reporting so that it does not show warning from deprecated code is not a good idea, we need to change our code so that it should be compatible with new php version is the right solution.

Thanks
Manish

D. Noe

unread,
Oct 7, 2010, 9:29:58 AM10/7/10
to zfdeve...@googlegroups.com, naveenkha...@gmail.com

Okay, first Manish is correct.  Avoiding errors/warnings rather than addressing them in a graceful manner will only cause confusion in the future.  Determine why your code is throwing errors and handle it appropriately.  If you are getting deprecation warnings, just figure out why the code is no longer compliant and update it according to the new techniques which would be described in changelogs for the language (specific to the version you are using).  If you read the documentation of the language you are coding in, or at least skim the areas where the changes are paramount in the development of your application, you will be maintaining a much happier codebase.

On Oct 7, 2010 7:20 AM, "Manish Khanchandani" <naveenkha...@gmail.com> wrote:

Hi,
changing error_reporting so that it does not show warning from deprecated code is not a good idea, we need to change our code so that it should be compatible with new php version is the right solution.

Thanks
Manish



On 10/6/2010 6:39 PM, Randell wrote:
>
> Hi guys,
>

> Just an update: in my case, the error was ca...

--

You received this message because you are subscribed to the Google Groups "Zend Framework Developers...

Randell

unread,
Oct 7, 2010, 10:20:21 AM10/7/10
to zfdeve...@googlegroups.com
Hi Manish, D.Noe,

Point taken. Unfortunately in my case, I had to work on the quick fix given the time constraints. But yeah, fixing the code would be the ideal solution.

Thanks!

You received this message because you are subscribed to the Google Groups "Zend Framework Developers" group.
To post to this group, send email to zfdeve...@googlegroups.com.
To unsubscribe from this group, send email to zfdevelopers...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/zfdevelopers?hl=en.

--
Reply all
Reply to author
Forward
0 new messages