Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Cache - SID issue?


RObW

Recommended Posts

Posted

Hi,

 

I have the cache feature enabled (correctly) - i.e.

 

Use Cache -> True

Cache Directory set (with ending slash) and permissions correct

 

but the files do not show up. I have figured out that the issue is to do with the 'if' statement that calls the cache in the column_left.php page:

 

if ((USE_CACHE == 'true') && empty($SID)) {

 

If the code is changed to exclude the && empty($SID) part, the cache works just fine.

 

Can anyone explain the reason for the $SID to be empty in order to use cache, if this can safely be removed to ensure cache works, or any other setting that shoudl be looked at to make cache work with code as is.

 

Cheers

Rob

Posted

Thanks for posting, but this wasn't useful - as I said, cache is set up correctly. It is just not being called becuase the SID is set as soon as a page is loaded (unless by a spider, of course).

 

I am looking for more than the newbies answer ;)

 

Cheers

Rob

Posted

Thats ok. Just wondering if it is a bug/typo (perhaps intended to be called if $SID is not empty, rather than empty...)

 

In case it is relevent, our store uses the following other session type settings:

 

STORE_SESSIONS = mysql

Prevent Spider sessions = TRUE

Force cookie use = FALSE

Check SSL Session ID = FALSE

Check User Agent = FALSE

Check IP Address = FALSE

Recreate Session = FALSE

 

Running OSC2.2MS2 on PHP v4.3.4 (Zend: 1.3.0) and MySQL 3.23.58

 

Cheers

Rob

Posted

Ah, so the cache feature is not designed to work with Force Cookies = False...

 

We left this setting disabled (so keeping SID in URL) as we are using a shared SSL server, so cannot use cookies. On testing, I see now that if the cache is used it picks up the SID in the cache URLs which is obviously not desirable.

 

Thanks for clearing this up. This should perhaps get into the documentation somehow as the forums are full of people trying to get this working by creating empty files in their cache folders...

 

Cheers

Rob

Posted
If the code is changed to exclude the && empty($SID) part, the cache works just fine.

 

Can anyone explain the reason for the $SID to be empty in order to use cache, if this can safely be removed to ensure cache works, or any other setting that shoudl be looked at to make cache work with code as is.

Referencing the following page:

 

http://de2.php.net/manual/en/ref.session.php

 

SID

 

Constant containing either the session name and session ID in the form of "name=ID" or empty string if session ID was set in an appropriate session cookie.

 

That means if SID is not empty, that the session ID is being used on the URL.

 

If session ID's are then cached, then everyone on the site would share the same session ID (due to it existing in pure HTML form in the cached file).

 

The check to see if SID is empty is to ensure that session IDs are never cached - meaning those with session IDs in the urls (cookies disabled?) never receive a cached segment and those with session IDs in the cookie do receive the cached segment.

 

The new database class implementation that will be finalized in the 2.2 Milestone 3 release will fix such cases where database results are cached instead of HTML segments.

:heart:, osCommerce

Posted

Thanks to all for clearing this up - there was a typo in our cookies directory path in configure.php which was causing the issue. As you said, no cookies, no cache...

 

Cheers

Rob

Archived

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

×
×
  • Create New...