Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

cookies not working.


phpConsult

Recommended Posts

Hello,

 

I'm trying to make an os2.2 based site work under php 5.6.

Since a lot is customised, it's not worthwhile to do a real upgrade.

Now I am running into a problem with cookies. They don't work i.e. I can't login or add products to the cart.

Take i.e. the following code in application_top.php:

 

    tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);

    if (isset($_COOKIE['cookie_test'])) {
      tep_session_start();
      $session_started = true;
    }
 
Although setcookie within function tep_setcookie does return 1 (true), $_COOKIE['cookie_test'] is not set.
What might be the problem here?
Link to comment
Share on other sites

Trying to make osC 2.2 work on PHP 5.6? Don't bother. You're better off spending the time customizing 2.3.4 or (better) 2.3.4BS. PHP has made a lot of changes over the years, including some radical changes in cookie handling. If you insist in going this route, I suggest you get a copy of the latest (2.3.4BS) and compare the code to your store, especially where cookies are handled. With a lot of hard work, you should be able to figure out what changes need to be made to the 2.2 code.

Link to comment
Share on other sites

Ok Thnx. The production site is currently running under PHP 5.3 which will not be supported anymore. However, it turned out that PHP 5.5.9 still will be supported. It seems that everything works normal with that version.

Could that be or are / will there be issues too?

Link to comment
Share on other sites

I'm not sure that such an old osC version will work correctly under PHP 5.5. I vaguely recall hearing about various PHP-related problems seen by people. It may appear to be working OK (did you make any PHP-related changes to the code?), but there could be some subtle errors that you haven't noticed yet.

 

Remember, your host won't keep PHP 5.5.9 around forever. Sooner or later they'll drop that one too, and then you'll really be up the creek. I would suggest that you start the process of migrating to 2.3.4BS (and hopefully soon, 2.4), even if your store seems to be working on PHP 5.5. Keep detailed notes on what add-ons you use and what custom code changes you make, and why (so you'll have an idea of what's needed when moving to a later version in the future). This will make it much easier to migrate in the future, which sooner or later you'll have to do. You'll also have the comfort of being PHP 7-ready, and having up-to-date security, and probably not having to do as much customization as you had to do with osC 2.2.

Link to comment
Share on other sites

Maybe you thought that you were running osC 2.2 under PHP 5.5, but you were actually still running PHP 5.3 at the time. As I said, I don't think osC 2.2 will run under PHP 5.5, at least not without a lot of fixing.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...