php-general Digest 25 Feb 2007 14:11:15 -0000 Issue 4645

Topics (messages 249382 through 249394):

Re: input on sessions vs cookies
        249382 by: Robert Cummings
        249383 by: tedd
        249385 by: benifactor
        249386 by: Fahad Pervaiz

Re: OT - FC6 as Web Server
        249384 by: Chris

PHP+MySQL website cache ? Yes/No
        249387 by: Martin Zvarík
        249388 by: Peter Lauri
        249389 by: Martin Zvarík
        249390 by: Martin Zvarík
        249391 by: lists.dwsasia.com
        249392 by: Colin Guthrie
        249393 by: Martin Zvarík
        249394 by: Sancar Saran

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
On Sat, 2007-02-24 at 17:48 -0800, benifactor wrote:
> i would like your input on session vs cookies regarding login data like 
> usernames/passwords ect...

How are you differentiating sessions vs cookies? Sessions are often
implemented USING cookies. If you mean sessions using a session ID in
the URL, versus using cookies to save actual user info then you are
already confused. Cookies should use the same mechanism as a URL session
ID. That is to say, they should store a unique identifier that can be
used to lookup the user's actual information. In this way the data that
can be manipulated by the dark forces is limited to one value... namely
the unique identifier.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
i would like your input on session vs cookies regarding login data like usernames/passwords ect...


usernames/passwords ? Session yes, cookies no.

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
as of right now, when the user logs in, i have a cookie storing username...
then on all of the pages i need data i have it query the database and using
the cookie data to retrieve user information.. is there a more secure way to
do this?

--- End Message ---
--- Begin Message ---
#####ORIGINAL######
i would like your input on session vs cookies regarding login data like
usernames/passwords ect...
####END ORIGINAL####


  - Main difference is that cookies are stored on the client machine and
  session is maintained on server machine.
  - Cookies can store information for longer period of time even if
  client leaves website whereas session is destroyed as soon as browser is
  closed
  - It is not adivsable to store passwords in cookies until unless you
  are using strong encryption algorithm
  - Session can also be hijacked by getting session id of an
  authenticated user
  - If you only want to use session or cookies use both. Store username
  in cookie so that when user visits your website later, you can prefill the
  username field. Store username in session for small period of time so that
  when user exits the session is destroyed
  - To ensure best security use database as well. Store IP, Session ID,
  username, login time. After every few minutes you can re authenticate the
  user against these parameters.

--
Regards
Fahad Pervaiz www.ecommerce-xperts.com
(Shopping Cart Applications, Framework
for Multilingual Web Sites, Web Designs)

--- End Message ---
--- Begin Message ---
I just got a plain FC6 server running. Anyone here who configured a FC6 for
several domains with mail, ftp, virtual domains etc?

I haven't done it with FC6 but have with previous versions of redhat as far back as 6.2 (I'm sure someone else will say they've done it for longer :P).

What does this have to do with php? I have absolutely no idea...

If you're having specific issues, try a more appropriate list.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Hi,
  I am making an eshop and I am thinking about caching system.

You understand, that it cannot be entirely cached because visitor has it's own shopping cart etc.

So, my thought is to cache only few blocks like "Categories", "Navigation menu" etc. by storing it to an HTML file.

The advantages are that it doesn't have to query database and generate the HTML code again, but my question is: Is it good approach? Shouldn't we optimize database instead of restoring the data on harddrive?

Thank you for ideas,
Martin Zvarik

--- End Message ---
--- Begin Message ---
MySQL has caching functions I believe. Read here:
http://dev.mysql.com/doc/refman/5.0/en/query-cache.html

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-----Original Message-----
From: Martin Zvarík [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 25, 2007 12:50 PM
To: [email protected]
Subject: [PHP] PHP+MySQL website cache ? Yes/No

Hi,
   I am making an eshop and I am thinking about caching system.

You understand, that it cannot be entirely cached because visitor has 
it's own shopping cart etc.

So, my thought is to cache only few blocks like "Categories", 
"Navigation menu" etc. by storing it to an HTML file.

The advantages are that it doesn't have to query database and generate 
the HTML code again, but my question is: Is it good approach? Shouldn't 
we optimize database instead of restoring the data on harddrive?

Thank you for ideas,
Martin Zvarik

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message --- I know it does, but I think it is still faster to include a generated HTML file than query a database. But is it worth the miliseconds?

---
Peter Lauri napsal(a):
MySQL has caching functions I believe. Read here:
http://dev.mysql.com/doc/refman/5.0/en/query-cache.html

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-----Original Message-----
From: Martin Zvarík [mailto:[EMAIL PROTECTED] Sent: Sunday, February 25, 2007 12:50 PM
To: [email protected]
Subject: [PHP] PHP+MySQL website cache ? Yes/No

Hi,
   I am making an eshop and I am thinking about caching system.

You understand, that it cannot be entirely cached because visitor has it's own shopping cart etc.

So, my thought is to cache only few blocks like "Categories", "Navigation menu" etc. by storing it to an HTML file.

The advantages are that it doesn't have to query database and generate the HTML code again, but my question is: Is it good approach? Shouldn't we optimize database instead of restoring the data on harddrive?

Thank you for ideas,
Martin Zvarik


--- End Message ---
--- Begin Message ---
I did a benchmark with and without caching to HTML file and it's like:

0.0031 sec (with) and 0.0160 sec (with database)

I know these miliseconds don't matter, but it will have significant contribution in high-traffic website, won't it?

Martin

--- End Message ---
--- Begin Message ---
Quoting Martin Zvarík <[EMAIL PROTECTED]>:

I did a benchmark with and without caching to HTML file and it's like:

0.0031 sec (with) and 0.0160 sec (with database)

I know these miliseconds don't matter, but it will have significant
contribution in high-traffic website, won't it?

Martin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Yes it will. And the 0.0129 seconds extra most of it is maybe to create the DB connection. Or are you using a persistent connection and reuseing it?

This benchmark was that together with all other content of the page? I mean including your dynamic shopping cart etc?

/Peter

--- End Message ---
--- Begin Message ---
Martin Zvarík wrote:
> I did a benchmark with and without caching to HTML file and it's like:
> 
> 0.0031 sec (with) and 0.0160 sec (with database)
> 
> I know these miliseconds don't matter, but it will have significant
> contribution in high-traffic website, won't it?

I would say yes. A good caching system is essential in a high traffic
system.

Ideally you'd allow very fine control over what "blocks" are cached and
for how long with automated system for extending the life of the cache
if the hosting environment is being hit hard.

e.g. autodetect high load and make the cache last for 1h rather than 5 mins.


I think you are on the right tracks to design this in.

Col

--- End Message ---
--- Begin Message --- This benchmark is not very accurate, but you are right the database connection took most of the time.

Shopping cart is stored in session - not in database.

I am half-way doing the eshop I bet it will took much more than 0.01 sec to generate the final version.

I was going to make this file cache system, but I relies that for each page like (?page=News, ?page=Products etc.) these HTML blocks (Navigation, Recommended) changes and that would mean I would have eventually like 50+ cached files.

One way or another I will always need to connect do database (I cannot cache 300 products in 300 files, can I?). So I decided to put the cache in database table - For each URL Name (news/, products/ etc) a Cache (which will be an array of all HTML blocks).

Martin




[EMAIL PROTECTED] napsal(a):
Quoting Martin Zvarík <[EMAIL PROTECTED]>:

I did a benchmark with and without caching to HTML file and it's like:

0.0031 sec (with) and 0.0160 sec (with database)

I know these miliseconds don't matter, but it will have significant
contribution in high-traffic website, won't it?

Martin

--PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Yes it will. And the 0.0129 seconds extra most of it is maybe to create the DB connection. Or are you using a persistent connection and reuseing it?

This benchmark was that together with all other content of the page? I mean including your dynamic shopping cart etc?

/Peter

--PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
Hi,

If you able to access memcached. Use memcached. 
Put your shopping chart items, rendered html items in memcached.

It was MUCH faster solution...

Regards

Sancar

On Sunday 25 February 2007 13:59, Martin Zvarík wrote:
> This benchmark is not very accurate, but you are right the database
> connection took most of the time.
>
> Shopping cart is stored in session - not in database.
>
> I am half-way doing the eshop I bet it will took much more than 0.01 sec
> to generate the final version.
>
> I was going to make this file cache system, but I relies that for each
> page like (?page=News, ?page=Products etc.) these HTML blocks
> (Navigation, Recommended) changes and that would mean I would have
> eventually like 50+ cached files.
>
> One way or another I will always need to connect do database (I cannot
> cache 300 products in 300 files, can I?). So I decided to put the cache
> in database table - For each URL Name (news/, products/ etc) a Cache
> (which will be an array of all HTML blocks).
>
> Martin
>
> [EMAIL PROTECTED] napsal(a):
> > Quoting Martin Zvarík <[EMAIL PROTECTED]>:
> >> I did a benchmark with and without caching to HTML file and it's like:
> >>
> >> 0.0031 sec (with) and 0.0160 sec (with database)
> >>
> >> I know these miliseconds don't matter, but it will have significant
> >> contribution in high-traffic website, won't it?
> >>
> >> Martin
> >>
> >> --PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > Yes it will. And the 0.0129 seconds extra most of it is maybe to create
> > the DB connection. Or are you using a persistent connection and reuseing
> > it?
> >
> > This benchmark was that together with all other content of the page? I
> > mean including your dynamic shopping cart etc?
> >
> > /Peter
> >
> > --PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---

Reply via email to