Jump to content

session_start() - makes site run slowly


Mogato

Recommended Posts

Hi,

 

I have a recently made a webbshop wich uses a session that stores all the products in an array (works fine), but then when I try to call the session/array it slows down the site... and it is the "session_start();" who does it. Below you find the code for my "shopping cart" which I include on all my sites and therefore make my whole site runs slowly :( anyone got any ideas of how to solve this problem? any easy way to get by this?

//------------------------------------
// SHOPPING CART
//------------------------------------
session_start(); 
session_register("products");

//Variables
$products= $_SESSION[products]; //uppdaterar variabeln med nya sessionen
$noitems = 0;

if (isset($products)){
foreach($products as $k => $v){ 
	$noitems += $products[$k]['noitems'];
}
}
//------------------------------------

Link to comment
https://forums.phpfreaks.com/topic/175765-session_start-makes-site-run-slowly/
Share on other sites

I would guess that you may need to have a word with your hosting company.

 

Doesn't seem right that it should slow the whole site.

 

I use sessions extensively and don't see any problems.

 

OK... could it be because I run the site on a Widows-server? should I switch to UNIX instead?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.