472,791 Members | 1,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

PHP sessions starting to fail

Hello there - we have a fairly busy server and we just started to have
problems with PHP sessions failing. We've never had this problem before and
to be honist, out server traffic is lower than it has been in prior months -
so I'm really not sure what could cause this.

Could anyone suggest some potentiol avenues to explore for reasons that
could cause PHP sessions to fail?

Thanks for any suggestions!
Jul 17 '05 #1
13 2298
jamie howard wrote:
Hello there - we have a fairly busy server and we just started to have
problems with PHP sessions failing. We've never had this problem before
and to be honist, out server traffic is lower than it has been in prior
months - so I'm really not sure what could cause this.

Could anyone suggest some potentiol avenues to explore for reasons that
could cause PHP sessions to fail?

Thanks for any suggestions!


erm, yes.

You could post to usenet saying what PHP version you're running. on what
platform, and what session handler you are using.

You might even say what you've checked already.

You could even explain what you mean by 'failing' does it fail to create a
session? does the session expire unexpectedly?

C.
Jul 17 '05 #2
Hi, sorry here is the additional information:
PHP version 4.3.3
Running on Linux Redhat 9
Running MySQL and PostGre and Apache1.3.22

OK, heres what happens on a typical failure:
Log in - no problem, browse site - fine for a few minutes, then,
sporadically I am redirected back to the login page for no apparent reason.

I am checking the session by isset($_SESSION['login'])

Cheers - Jamie

"Colin McKinnon" <co**************@andthis.mms3.com> wrote in message
news:d3*******************@news.demon.co.uk...
jamie howard wrote:
Hello there - we have a fairly busy server and we just started to have
problems with PHP sessions failing. We've never had this problem before
and to be honist, out server traffic is lower than it has been in prior
months - so I'm really not sure what could cause this.

Could anyone suggest some potentiol avenues to explore for reasons that
could cause PHP sessions to fail?

Thanks for any suggestions!


erm, yes.

You could post to usenet saying what PHP version you're running. on what
platform, and what session handler you are using.

You might even say what you've checked already.

You could even explain what you mean by 'failing' does it fail to create a
session? does the session expire unexpectedly?

C.

Jul 17 '05 #3
Also, I provide enclosed a dump from the shell comand "top"

Things we noted about it were:
1) Lots of mysql threads? not sure why - maybe we have a dodgy script?
2) Lots of httpd threads - is this normal
3) A few python threads - we don't know anything about python or why they
appear.
OK- heres the dump:

1:46pm up 5:50, 1 user, load average: 0.01, 0.00, 0.00
118 processes: 116 sleeping, 1 running, 1 zombie, 0 stopped
CPU states: 0.5% user, 0.7% system, 0.0% nice, 98.6% idle
Mem: 248620K av, 241784K used, 6836K free, 0K shrd, 16516K
buff
Swap: 787176K av, 5024K used, 782152K free 148944K
cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
872 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:00 mysqld
874 mysql 10 10 7464 7464 2284 S N 0.0 3.0 0:00 mysqld
875 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:00 mysqld
876 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:00 mysqld
5230 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:02 mysqld
5261 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:01 mysqld
5448 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:01 mysqld
5449 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:01 mysqld
5466 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:02 mysqld
5468 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:00 mysqld
5472 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:03 mysqld
5474 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:01 mysqld
5488 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:03 mysqld
5492 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:01 mysqld
5664 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:00 mysqld
5665 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:00 mysqld
5712 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:00 mysqld
5734 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:00 mysqld
5742 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:00 mysqld
5762 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:00 mysqld
5841 mysql 14 10 7464 7464 2284 S N 0.0 3.0 0:00 mysqld
5907 mysql 15 10 7464 7464 2284 S N 0.0 3.0 0:00 mysqld

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
5234 apache 5 -10 10520 9.9M 7868 S < 0.0 4.0 0:06 httpd
5200 apache 5 -10 10268 9912 7796 S < 0.0 3.9 0:06 httpd
5454 apache 5 -10 10256 9900 7756 S < 0.0 3.9 0:02 httpd
5445 apache 5 -10 10176 9816 7676 S < 0.0 3.9 0:02 httpd
5473 apache 5 -10 10124 9764 7672 S < 0.0 3.9 0:02 httpd
5460 apache 6 -10 10076 9720 7716 S < 0.1 3.9 0:02 httpd
5461 apache 5 -10 9780 9420 7608 S < 0.0 3.7 0:02 httpd
5446 apache 5 -10 9212 8852 7724 S < 0.0 3.5 0:03 httpd
5469 apache 5 -10 9108 8748 7672 S < 0.0 3.5 0:02 httpd
5447 apache 5 -10 9056 8696 7668 S < 0.0 3.4 0:02 httpd
1099 root 5 -10 12128 11M 2296 S < 0.0 4.5 0:16 python2.1
1244 root 5 -10 12128 11M 2296 S < 0.0 4.5 0:00 python2.1
1245 root 5 -10 12128 11M 2296 S < 0.0 4.5 0:02 python2.1
1246 root 5 -10 12128 11M 2296 S < 0.0 4.5 0:00 python2.1
1247 root 5 -10 12128 11M 2296 S < 0.0 4.5 0:00 python2.1
1248 root 5 -10 12128 11M 2296 S < 0.0 4.5 0:00 python2.1
1249 root 5 -10 12128 11M 2296 S < 0.0 4.5 0:01 python2.1

"jamie howard" <jw*@web-engineer.co.uk> wrote in message
news:%x*******************@fe1.news.blueyonder.co. uk...
Hi, sorry here is the additional information:
PHP version 4.3.3
Running on Linux Redhat 9
Running MySQL and PostGre and Apache1.3.22

OK, heres what happens on a typical failure:
Log in - no problem, browse site - fine for a few minutes, then,
sporadically I am redirected back to the login page for no apparent
reason.

I am checking the session by isset($_SESSION['login'])

Cheers - Jamie

"Colin McKinnon" <co**************@andthis.mms3.com> wrote in message
news:d3*******************@news.demon.co.uk...
jamie howard wrote:
Hello there - we have a fairly busy server and we just started to have
problems with PHP sessions failing. We've never had this problem before
and to be honist, out server traffic is lower than it has been in prior
months - so I'm really not sure what could cause this.

Could anyone suggest some potentiol avenues to explore for reasons that
could cause PHP sessions to fail?

Thanks for any suggestions!


erm, yes.

You could post to usenet saying what PHP version you're running. on what
platform, and what session handler you are using.

You might even say what you've checked already.

You could even explain what you mean by 'failing' does it fail to create
a
session? does the session expire unexpectedly?

C.


Jul 17 '05 #4
jamie howard wrote:
Log in - no problem, browse site - fine for a few minutes, then,
sporadically I am redirected back to the login page for no apparent
reason.
It's only the one server and there's no [transparent?] web proxy twixt you
and it?

Possible options:
- browser is forgetting whom you are
- server is deleting session prematurely
- scripts are changing new session

I'd suggest logging in, noting you session id (you only need the last, say 4
chars) playing around till it breaks then checking the session id.

Also find the dir where the sessions are stored, (if you've got a lot of
sessions you'll probably need more than 4 chars) and see if there is a file
name after your session id.
1) Lots of mysql threads? not sure why - maybe we have a dodgy script? (not threads - processes)
2) Lots of httpd threads - is this normal for a "fairly busy server" maybe. How many do you normally have?
3) A few python threads - we don't know anything about python or why they
appear.

Usually 'there's code running on my server and I don't know what it is nor
where it came from nor who is running it' is a bad sign. Try 'ps auxww |
grep python'

HTH

C.
Jul 17 '05 #5
In article <%x*******************@fe1.news.blueyonder.co.uk >,
jamie howard wrote:
Hi, sorry here is the additional information:
PHP version 4.3.3
Running on Linux Redhat 9
Running MySQL and PostGre and Apache1.3.22

OK, heres what happens on a typical failure:
Log in - no problem, browse site - fine for a few minutes, then,
sporadically I am redirected back to the login page for no apparent reason.

I am checking the session by isset($_SESSION['login'])


Is your apache crashing? Check logs.
Jul 17 '05 #6
JDS
On Fri, 15 Apr 2005 12:35:07 +0000, jamie howard wrote:
Hi, sorry here is the additional information:
PHP version 4.3.3
Running on Linux Redhat 9
Running MySQL and PostGre and Apache1.3.22

OK, heres what happens on a typical failure:
Log in - no problem, browse site - fine for a few minutes, then,
sporadically I am redirected back to the login page for no apparent reason.

I am checking the session by isset($_SESSION['login'])

Cheers - Jamie


You said this thing used to work fine.

In my experience, when it comes to computers, the *last thing changed* is
the thing that is causing the problem. What is the last thing you did on
this system?

Now, I mean *anything*. Did you install a new disk? Did you install some
new software? Did you make any changes, however small, to the PHP
application?

No matter how seemingly unrelated the change is to the problem, computers
don't just spontaneously start doing goofy things (well, I guess they do
sometimes).

Just some debugging advice from a person who has been there before.

later...

--
JDS | je*****@go.away.com
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

Jul 17 '05 #7
"jamie howard" <jw*@web-engineer.co.uk> wrote in message
news:%x*******************@fe1.news.blueyonder.co. uk...
Hi, sorry here is the additional information:
PHP version 4.3.3
Running on Linux Redhat 9
Running MySQL and PostGre and Apache1.3.22

OK, heres what happens on a typical failure:
Log in - no problem, browse site - fine for a few minutes, then,
sporadically I am redirected back to the login page for no apparent reason.
I am checking the session by isset($_SESSION['login'])


What is your session save path? It could be that some other process it
deleting your session files.

One problem I have run into in the past is storing objects in the session.
If you store an object in the session and another page, which doesn't have
the class definition, opens the session and modifies it, the object *might*
disppear.
Jul 17 '05 #8
Ok - i am posting more details on our problem....

The server is running the Ensim management software this is where the Python
threads were comming from.

Looking closer i have a hunch its mysql related, and/or a recent changed
script causing the problem.

Our mySql config is real simple however and there are no innodb tables in
any of the databases runinng on the server, so i dont think its innodb
related, however i am looking into removing innodb support support from my
mysql server if nothing turns up from the alalysis of all changed scripts.

It may simply be a performance issue as the server is now pushing upto 2000
sessions daily, and at times i have seen 500 sessions open in the /tmp
directory.

Any tips on how to tune LAMP server to maximise performance would be
apreaciated - or tips on where else we should be looking to cure this
problem.

Unfortunately we have no control on the hardware, which consists of 256mb of
ram, 40gb drive and 2ghz processor. Therefore performace optomisations need
to remain around the configuration of the services.
Jul 17 '05 #9
Craig Lawson wrote:
Ok - i am posting more details on our problem....

The server is running the Ensim management software this is where the Python threads were comming from.

Looking closer i have a hunch its mysql related, and/or a recent changed script causing the problem.

Our mySql config is real simple however and there are no innodb tables in any of the databases runinng on the server, so i dont think its innodb related, however i am looking into removing innodb support support from my mysql server if nothing turns up from the alalysis of all changed scripts.
It may simply be a performance issue as the server is now pushing upto 2000 sessions daily, and at times i have seen 500 sessions open in the /tmp directory.
Probably that might be the reason for session to fail--as there may
not be any room for the session files to be created. The quick
workaround would be switching to DB based session handler--but that
will hit DB load.
Any tips on how to tune LAMP server to maximise performance would be
apreaciated - or tips on where else we should be looking to cure this problem.
If the problem is related to MySQL, you may try some caching
solutions
<http://groups.google.com/groups?selm=1111430495.275366.42540%40z14g2000cwz. googlegroups.com>

I would also recommend "High Performance MySQL" by Jeremy et al.
<http://www.oreilly.com/catalog/hpmysql/>
Unfortunately we have no control on the hardware, which consists of 256mb of ram, 40gb drive and 2ghz processor. Therefore performace optomisations need to remain around the configuration of the services.


To analyze the bottlenecks, you may need some good profilers like
APD <http://in2.php.net/apd> But, running profilers in a live site will
hit performance severely.

<rant>
FWIW, IMHO, though PHP is enterprise ready with lot of tools, PHP
programmers are far behind code optimization and etc unlike other
domain programmers.
</rant>

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jul 17 '05 #10
R. Rajesh Jeba Anbiah wrote:
Craig Lawson wrote:
Ok - i am posting more details on our problem....

It may simply be a performance issue as the server is now pushing

upto 2000
sessions daily, and at times i have seen 500 sessions open in the

/tmp
directory.


Probably that might be the reason for session to fail--as there may
not be any room for the session files to be created. The quick
workaround would be switching to DB based session handler--but that
will hit DB load.


Putting the sessions into the DB will actually use up MORE space than files.
(although it should retain a 'high-water' mark) and more cpu.
Any tips on how to tune LAMP server to maximise performance would be
apreaciated - or tips on where else we should be looking to cure this


None to hand - how sure are you that there's a performance issue? It doesn't
sound like a lot of traffic. What you should be looking at is the load,
number of httpd processes and number of mysql processes.

There's a whole section in the mysql manual about tuning it. Turn on the
slow query logging.

Memory is likely to be tight on the spec cited.

HTH

C.

Jul 17 '05 #11
"Craig Lawson" <cel[remove]@[remove]web-engineer.co.uk> wrote in
news:fj*******************@fe3.news.blueyonder.co. uk:

Unfortunately we have no control on the hardware, which consists of
256mb of ram, 40gb drive and 2ghz processor. Therefore performace
optomisations need to remain around the configuration of the services.


"Make my car go faster, but don't change anything about the engine."
Jul 17 '05 #12
One quick glance of an experienced eye allowed to understand the blurred
and almost unreadable Good Man's handwriting:
"Craig Lawson" <cel[remove]@[remove]web-engineer.co.uk> wrote in
news:fj*******************@fe3.news.blueyonder.co. uk:

Unfortunately we have no control on the hardware, which consists of
256mb of ram, 40gb drive and 2ghz processor. Therefore performace
optomisations need to remain around the configuration of the services.


"Make my car go faster, but don't change anything about the engine."


Yeah, remember you can do lots of things about the wheels, the fuel, and
so on. :)
Same thing's here - while there is no hw upgrade possible, I'm sure we
can think of a few sw optimizations, can't we?

Cheers
Mike
Jul 17 '05 #13
Thanks - looking into the MySQL config tonight.....

"Colin McKinnon" <co**************@andthis.mms3.com> wrote in message
news:d3*******************@news.demon.co.uk...
R. Rajesh Jeba Anbiah wrote:
Craig Lawson wrote:
Ok - i am posting more details on our problem....

It may simply be a performance issue as the server is now pushing

upto 2000
sessions daily, and at times i have seen 500 sessions open in the

/tmp
directory.


Probably that might be the reason for session to fail--as there may
not be any room for the session files to be created. The quick
workaround would be switching to DB based session handler--but that
will hit DB load.


Putting the sessions into the DB will actually use up MORE space than
files.
(although it should retain a 'high-water' mark) and more cpu.
Any tips on how to tune LAMP server to maximise performance would be
apreaciated - or tips on where else we should be looking to cure this


None to hand - how sure are you that there's a performance issue? It
doesn't
sound like a lot of traffic. What you should be looking at is the load,
number of httpd processes and number of mysql processes.

There's a whole section in the mysql manual about tuning it. Turn on the
slow query logging.

Memory is likely to be tight on the spec cited.

HTH

C.

Jul 17 '05 #14

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

Similar topics

9
by: E. Will | last post by:
Hello world, Myself and a few friends have been experiencing the same problem. When using sessions in PHP for ``logins'' we experience the sessions ``mixing.'' To say, one user logs in as...
5
by: bryan | last post by:
Hi folks, I've got a question about sessions in PHP. I'm a *gulp* ASP coder, so please bear with me. I developed a PHP site a few months back that has a password protected entry into a...
3
by: Gary W | last post by:
Hello, I have used SESSIONS on mission critical pages on my site, and if sessions are not enabled / supoorted - these pages will fail. When and why would a session fail? They do not store any...
0
by: Nonoy of Philippines | last post by:
Hello, guys... I'm just starting to develop web applications and I have this problem regarding Session objects At some parts of my application, I open modal dialog window which also opens...
1
by: Nick Wouters | last post by:
Dear all I sended this reply to my first issue a few days ago... please help!!! ----------------------------------------------------------------------------- correct, but when I am using...
7
by: Steve Wright | last post by:
Forgive my ignorance, but I am just starting to learn about sessions in PHP and how to pass data from one page to the next. What I'm about to explain could just be my misunderstanding of how...
7
by: Nico | last post by:
Dear all, I made the following form. <FORM METHOD="POST" ACTION="prova.php"> <b>Combination</b><br><br> Element 1: <INPUT NAME="el1" TYPE="TEXT"> <BR> Element 2: <INPUT NAME="el2"...
8
by: Chuck Anderson | last post by:
I've instituted a sessions based scheme on my web site to combat hot linking to my images. When someone requests a page at my site, I set a session variable. I then use htaccess to redirect *all*...
13
pradeepjain
by: pradeepjain | last post by:
hii guys , I am giving a presentation on sessions and cookies. i want to say points which are really worth telling . So i need some points about sessions and cookies which needs to...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?

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.