473,396 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Session generation problem

Hi Group members !

We are hosting a Apache/PHP/MySql based website at our college since
January,2005. It was working fine since then. The web server is plaed
in our college itself and we are using IP binding method to make it
available globally.

We are having a login page which redirects the user again to home page
after authentication but with a session started. But the problem was
that every time the user enters his username and password, he was
redirected to home page but no session was genrated i.e. he is logged
in.

We tried to work out a solution for the problem but coudn't find one.
But to our surprise, the site started working normally on its own after
about 3 hours.

But yesterday, the same problem again surfaced and again we had no
solution. Thinking of past instance, we waited for many hours but the
problem sustained.
And still our site is affected with that problem.

The tecnical information :
Web server : Apache 2.0.52 Build Oct 15, 2004
PHP interpreter : PHP 4.3.9 Build Oct 20, 2004
Operating System : Linux Fedora Core 3

Can anyone suggest any solution or reference for the problem ?

Aug 24 '05 #1
4 1460
varungupta wrote:
Hi Group members !

We are hosting a Apache/PHP/MySql based website at our college since
January,2005. It was working fine since then. The web server is plaed
in our college itself and we are using IP binding method to make it
available globally.

We are having a login page which redirects the user again to home page
after authentication but with a session started. But the problem was
that every time the user enters his username and password, he was
redirected to home page but no session was genrated i.e. he is logged
in.

We tried to work out a solution for the problem but coudn't find one.
But to our surprise, the site started working normally on its own after
about 3 hours.

But yesterday, the same problem again surfaced and again we had no
solution. Thinking of past instance, we waited for many hours but the
problem sustained.
And still our site is affected with that problem.

The tecnical information :
Web server : Apache 2.0.52 Build Oct 15, 2004
PHP interpreter : PHP 4.3.9 Build Oct 20, 2004
Operating System : Linux Fedora Core 3

Can anyone suggest any solution or reference for the problem ?

Hi,

That is a really weird problem.
Next time you are unable to start session, do some testing.

Here are some things of importance to get a general idea.
I take it you store session in a temp-dir serialized (which is default
behaviour). If you use a database to store session, do something similar as
I decribed here to hunt down the bug.

0) Download Firefox as browser if don't have that already.
1) Thow away all your cookies.
2) Log into the system via the website as you always do.
3) check if a cookie is placed. It will have a name like: PHPSESSID and it
will contain a whole lot of random characters.
Note that string.
4) Look on the machine where PHP is running and check the temp-dir.
(You can find the temp-dir in php.ini, or when it is not set there: it is
the default tempdir, like /tmp)
5) Do you see a file in there with the same number-characterstring as the
cookie contained?

What do you find?

Regards,
Erwin Moller
Aug 24 '05 #2
varungupta wrote:

We are having a login page which redirects the user again to home page
after authentication but with a session started. But the problem was
that every time the user enters his username and password, he was
redirected to home page but no session was genrated i.e. he is logged
in.

We tried to work out a solution for the problem but coudn't find one.
But to our surprise, the site started working normally on its own after
about 3 hours.

But yesterday, the same problem again surfaced and again we had no
solution. Thinking of past instance, we waited for many hours but the
problem sustained.
And still our site is affected with that problem.


The default session handler does not scale well, although I suspect the
problem may lie elsewhere (permissions on session dir? disk space?).

Try using a MySQL session handler.

C.
Aug 24 '05 #3
Hi Erwin !

Its great to have reply from your side.
I have checked all the points mentioned by you and found that the
session is starting and cookies are generated on both server as well as
client side.
We have tried a test script to check session handling.
We started a general session by simply using session_start() and found
that the session was successfuly generated. We even stored and
successfully retrieved values on the same page but when we moved to
next page the session was not there, i.e. session was not continued on
next page.
Now please enlighten me.

Aug 24 '05 #4
varungupta wrote:
Hi Erwin !

Hi,
Its great to have reply from your side.
*blushes*
I have checked all the points mentioned by you and found that the
session is starting and cookies are generated on both server as well as
client side.
We have tried a test script to check session handling.
We started a general session by simply using session_start() and found
that the session was successfuly generated. We even stored and
successfully retrieved values on the same page but when we moved to
next page the session was not there, i.e. session was not continued on
next page.
Now please enlighten me.


Ok, always good to make a few simple scripts to test this. :-)

so: page1.php starts a session.
page2.php tries to read the session (without succes).

Try to add on page2.php some things like:
- echo session_id()
- dump all cookies print_r($_COOKIES);

what do they say?

and maybe read up here (if you didn't do so already)
http://nl2.php.net/manual/en/ref.session.php
Last resort:
I had some (confusing) trouble with Sessions before, when using
session_start().
I switched to 'session.auto_start' by modifying php.ini, and I never had
problems again. :-/
If you can modify php.ini, you could give that a try.
You can also delete all session_start() from your scripts then. :-)

Hope that helps a bit.
It is always difficult to debug a remote system. :P

Reagrds,
Erwin Moller
Aug 24 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
0
by: Rasmus Fogh | last post by:
Someone raised the question of automatic code generation a few weeks back. And yes, we (CCPN) are using automatic Python code generation in a major way. Basically we are making data models in...
4
by: Kent Tegels | last post by:
Okay, so I know I'm doing two evil things: using Frames and storing stuff in Session. I'm a sinner and I'll repent after this project, I promise. But for now, I've got an interesting issue. ...
5
by: Frank | last post by:
Our system maintains session state using the ASP.NET State Server service. We expect some of our session state objects to be over 85K, which categorizes them to be VLO's (very large objects) in terms...
3
by: Philip Tepedino | last post by:
I'm having an odd problem. My website's session state is getting shared between users! This problem only happens when a user tries to access the site from inside our corporate LAN. The user,...
0
by: mark | last post by:
Code Generation 2007 Cambridge, UK May 18 - 20 2007 Web: http://www.codegeneration.net/cg2007/ Code Generation 2007 is a new event for software practitioners. The event will cover: Software...
9
by: karthi84 | last post by:
hi, i have used session in my .net project. its version is 1.1, when ever i load that page i get the following error, Server Error in '/Alfi/invoice generation/WebApplication1'...
2
by: =?Utf-8?B?YW5vb3A=?= | last post by:
Hello, I am developing a Simple ASP Application with a Login page. I want to know how session ID can be generated after User has authenticated instead of generation along with the Login page...
4
by: =?Utf-8?B?Y2FzaGRlc2ttYWM=?= | last post by:
Hi, I am getting the following error intermittently: "Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when Session...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.