osCommerce: Session save path Fix

If you are using MySQL based sessions in your osCommerce installation and your PHP runs with Safe Mode set to On, you receive the following message:

Warning: session_save_path() [function.session-save-path]: SAFE MODE Restriction in effect. The script whose uid is X is not allowed to access owned by uid Y in /path/to/your/oscommerce/catalog/includes/functions/sessions.php on line 149

We also recommend this MOD when your web server has Safe Mode Off too.

Open:
catalog/includes/functions/sessions.php

Find:

  function tep_session_save_path($path = '') {
    if (!empty($path)) {
      return session_save_path($path);
    } else {
      return session_save_path();
    }
  } 

Replace with:

  function tep_session_save_path($path = '') {
    if (STORE_SESSIONS != 'mysql') {
      if (!empty($path)) {
        return session_save_path($path);
      } else {
        return session_save_path();
      }
    }
  } 

Open:
catalog/admin/includes/functions/sessions.php

Find:

  function tep_session_save_path($path = '') {
    if ($path != '') {
      return session_save_path($path);
    } else {
      return session_save_path();
    }
  } 

Replace with

  function tep_session_save_path($path = '') {
    if (STORE_SESSIONS != 'mysql') {
      if (!empty($path)) {
        return session_save_path($path);
      } else {
        return session_save_path();
      }
    }
  } 

Save and close all files and it’s done!

Leave a Reply

Your email address will not be published. Required fields are marked *

Cart  
(empty)

Cart Check out  »

Prices are tax inclusive.

The VAT rate for your country (US) * is 0,0 % because it is not a member of the European Union (EU).

* Please create an account if your country does not match.

Community feed
  • [WordPress] Accelerator issue
    I have installed the plugin, but when activated, the website goes down and appears this message : Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in...
    by flynet
  • [PrestaShop] Theme Provider FREE 1.4
    where I can download this plugin for testing mode before I byu it? thank you. DB
    by daryl0
  • [phpBB3] How to disable Magic SEO URL for phpBB?
    Moderator note: A new update of the Magic SEO URLs for phpBB 3.0/3.1/3.2 has been released. It comes with the phpBB 3.0/3.1/3.2 support as well as PHP 7.0 support. Hello ! I want to...
    by Binano
  • [Zen Cart] How to add .html to urls
    How do I get .html added to the product url? I could not find any mention in the documentation.
    by jekingwws
  • [Zen Cart] .htaccess file will not generate
    I have version 6 installed on a development server for a client. Installation went smoothly, no issues or errors. Files all uploaded in binary. Yet the htaccess file will not generate....
    by jekingwws
Join our support forum » Pre-Sales Questions »
Featured Testimonials

The Inveo team provided the best service and support that we have received from any vendors we have ever used. They did work that was far beyond the scope of the purchase, and for this we are grateful and can certainly highly recommend them to anyone else.

Allen, the owner of Zele Private Investigator Philippines

We have a fully customizable website based in osCommerce, we work with it since our start in 2005. When we want to expand our business to other countries near Spain, we know that we would have several problems with SEO and Google. We found Magic SEO URLs luckily and in fact Magic SEO URLs provide us a complete solution to solve our...

Ruben, the owner of MASmuscolo

More Testimonials »