Session_Start Seems to Be Very Slow (But Only Sometimes)

session_start seems to be very slow (but only sometimes)

Have you tried session_write_close(); ?
This will disable write-ability in session variables but you can still read data from them. And later when you need to write a session variable, reopen it.

I have also suffered from this problem but this thing worked like a charm. This is what i do:

session_start(); //starts the session
$_SESSION['user']="Me";
session_write_close(); // close write capability
echo $_SESSION['user']; // you can still access it

Zend_Session::Start intolerably slow (but only sometimes)

Take a look at your session garbage collection mechanism (play with probability and divisor).

If gc is slowing down the app, consider cleaning the old sessions manually (e.g. setting gc probability to 1 and running gc script via cron).

Another possibilities:

  • session mechanism is locked (so the app waits to unlock, then write)
  • too much data saved

Problem with function session_start() (works slowly)

The file containing the session's informations is locked during the time PHP serves a request.

So, if you have one PHP script (using a session) that's currently being executed, and the same user sends another request, the second request will wait until the first is finished.

session_start() takes long time and makes pages pending

Solution: session_write_close(); and PHP Session Lockes

<?php
// First File
if(session_id() == '')
session_start();
session_write_close();
sleep(10);

session_start() makes site unreachable

I fixed my problem by completly uninstalling my xampp version and reinstalling the latest one. What I still dont know is why that error appeared in the first place.



Related Topics



Leave a reply



Submit