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
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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.