Re: [PHP] $_SESSION v. Cookies

[email protected] (Robert Cummings)
Newsgroups php.general
Organization InterJinn
Message-ID <1210178083.31111.27.camel@blobule>
On Wed, 2008-05-07 at 12:27 -0400, Scott Campbell wrote:
> Dear PHP List,
> 
>     PHP 5, Apache2, MySQL 5, running on Ubuntu, viewing & deving with
> FireFox and Konqueror (Linux).
> 
>     I am building a site with multiple tools and want to pass variables
> throughout them all.  Before, I was passing variables using <hidden> HTML
> Form tags, but the site has grown too large for this tactic, so I went to
> using $_SESSION.  However, when I started using $_SESSION, my site loads 3-5
> times slower then before.  A page that queried MySQL and built itself in 3-5
> seconds was now taking 15-20.  While more has changed then just $_SESSION,
> it is really the only significant difference.
> 
>     Is $_SESSION slowing down my site?  Is there a faster alternative to
> global variables then using $_SESSION?  Are using regular cookies faster?
> 
>     Any help is appreciated.

How are your sessions implemented? Are you using the stock PHP session
functionality or did you cook your own solution? I can't see the stock
PHP solution adding anything more than a split second to your page time.
The exception being when it performs cleanup. Cleanup should be
relegated to a cron job. Have you added anything new to the database?
new query perhaps on a large table that doesn't make use of indexes?
Small changes can have a bigger impact than large changes depending on
what exactly changed.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.