Welcome Guest, Not a member yet? Register   Sign In
session_start(): Cannot send session cookie

(This post was last modified: 09-11-2015, 12:46 AM by johancelis.)

I have developed a site on my local machine (WAMP).
Everything works fine on my machine.

When I move my code to the production server I get the following errors:

A PHP Error was encountered

Severity: Warning

Message: session_start(): Cannot send session cookie - headers already sent by (output started at /customers/e/3/2/kskzingem.eu/httpd.www/beheer/application/helpers/tools_helper.php:45)

Filename: Session/Session.php

Line Number: 140

The tools_helper.php file is autoloaded. When I do not autoload it the problem occurs in another php file.
I believe the problem is not related to the code in the tools_helper.php file.

My site is hosted at one.com.
Before I released this code I had a smaller version of the same site running on one.com.
At that time I did not use sessions.

The site is hosted on a subdomain: beheer.kskzingem.eu.

For the moment I have no idea where to look for the solution.

Any help is greatly appreciated!



After some more digging I found out that the cause of the issue is most likely the redirect statements in the code.
When you open the site it checks if you are logged in. If not you are redirected to the login page.
If I remove the redirect, I get to see at least part of the site.

It means your tool_helper is outputting header data to the screen, before the cookie is written.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

I just solved the problem.

I had two php files that had white spaces after the closing tag.

Theme © iAndrew 2016 - Forum software by © MyBB