This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes PHP and the fly likes PHP : Problem with the method session_start(); Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Languages » PHP
Bookmark "PHP : Problem with the method session_start();" Watch "PHP : Problem with the method session_start();" New topic
Author

PHP : Problem with the method session_start();

sudeep naayak
Greenhorn

Joined: Sep 04, 2009
Posts: 5
I have mentioned this code at 1st line of my code.

It is working fine in localhost. But when I uploaded to my server then it shows me the following warning

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at ......

After viewing this warning rest of the page working fine.

Can anybody help me ...how to remove this warning and tell me the reason for what this is coming only at server not in localhost.

K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2247
    
    7

Welcome to the Ranch Sudeep.

The reason could be your local Apache server and the server's Apache server configuration is not the same. One way to check is to echo the session_cache_limiter or check the phpinfo().

Base on the returned value, you may want to change it BEFORE calling session_start();

Another way is something to do with output buffering, which must be called (ob_start()) before session_start();

Hope this helps.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
sudeep naayak
Greenhorn

Joined: Sep 04, 2009
Posts: 5
Thanks a lot.

I tried it in another way and it worked.

Here I am calling session_start() method at the starting of my code.

But I am using session parameters some what later. I declared the same session_start() method again here also.

Now it works fine

I think due to older version of php in the server it requires to initialize the session where exactly it needs.

By the way Thanks for the valuable information and your time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PHP : Problem with the method session_start();
 
Similar Threads
difficulty in login in one attempt
html5 and php
php , html ...
Need to implement Session time out in PHP code
using the value of a session variable