session start()

92 views
Skip to first unread message

monaye

unread,
Dec 23, 2010, 3:20:19 AM12/23/10
to php-form-builder-class
I read in other post that I need session start() for pfbc to work.

So, I put session start() right before include pfbc class. It was work
fine on my local but, when I put on shared server I am getting,

PFBC Configuration Error: A PHP Session is required to generate this
form's necessary javascript and stylesheet information. To correct,
simply add "session_start();" before any output in your script.

and

Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at .php:14)
in .php on line 77


I don't get Warning if I move session_start() to top of the page, but
If I still get PFBC cofig error and pfbc doesn't load css and js.

Not sure how to troubleshoot..

Thank you for the help,
monaye

Andrew Porterfield

unread,
Dec 23, 2010, 9:36:38 AM12/23/10
to php-form-bu...@googlegroups.com
Monaye,

PHP will give you the warning message you provided in your previous email if you try to call session_start() after content has been sent to the user's browser.

It's difficult for me to provide any feedback b/c I don't know the details of your system. Do the examples included with the project's download function properly?

- Andrew

Bart Lateur

unread,
Jan 12, 2011, 3:04:47 AM1/12/11
to php-form-builder-class
On Dec 23 2010, 9:20 am, monaye <winmon...@gmail.com> wrote:

> Warning: session_start() [function.session-start]: Cannot send session
> cache limiter - headers already sent (output started at .php:14)
> in .php on line 77
>
> I don't get Warning if I move session_start() to top of the page, but
> If I still get PFBC cofig error and pfbc doesn't load css and js.
>
> Not sure how to troubleshoot..

The remedy is quite simple: put

<?php session-start(); ?>

at the top of your PHP page.

The reason for this warning is that sessions make use of cookies.
Cookies are sent to the browser in the headers. Once you have already
sent html to the browser, the headers are over and the body has
already started.

So, you have to do this before the body starts: in the first PHP
block, and with *not any* html in front of it.

--
Bart.
Message has been deleted

Phantasma

unread,
Jan 12, 2011, 8:30:54 AM1/12/11
to php-form-builder-class
I'm having sort of a similar problem.

The site was working fine on the local server, but on the live server
it gives the same error as monaye.

The problem seems to be how the server handles sessions. It's a PHP
5.3.0 machine and I've manualy added:
session.auto_start = Off
session.use_trans_sid = On
in php.ini.

If i leave session.auto_start on this error does not occur. I cannot
however since it breaks objects in my session since it starts the
session before my autoload function.
So, I pass the session name and after session_start I did a print_r on
my session and it's empty. I've also tried with session id...same
thing.

Does anyone have any idea what might be causing this? Maybe a php
configuration variable, or maybe apache?

Thanks
Message has been deleted

Phantasma

unread,
Jan 12, 2011, 9:06:02 AM1/12/11
to php-form-builder-class
Yes, same domain. But since having session.auto_start On doesn't give
the error it's probably not a crossdomain issue.

On Jan 12, 3:52 pm, ocos 2010 <ocos2...@gmail.com> wrote:
> Does your code include the includesPath from the same domain?
>
> 2011/1/12 Phantasma <coreallia...@gmail.com>

Phantasma

unread,
Jan 12, 2011, 10:52:28 AM1/12/11
to php-form-builder-class
I've managed to find a solution. I've added the same php.ini file
inside the includes folder. That fixed! It's probably bad server
settings or something since it should have worked with just one
php.ini in the root folder of the site.
Reply all
Reply to author
Forward
0 new messages