PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, July 22, 2022

[FIXED] How to get osCommerce 2.2 running on PHP 5.4?

 July 22, 2022     oscommerce, php-5.4     No comments   

Issue

I recently upgraded PHP to 5.4 and after adding some tweaks now the old osCommerce installation of a customer with lots of customisations is running again, but there is still a problem:

if you put an item in your cart the cart stays empty

How can I fix this?
Is there a certain php value I can set in php.ini so the session is working properly?


What I have tweaked so far:

Problem: all prices are 0 and there is no currency
Solution: adding !isset($currency) || in the paragraph `//
(see $currency not set in application_top under PHP 5.4 )

Problem: register_globals is REMOVED as of PHP 5.4.0
Solution: I simulated register_globals with this: https://serverfault.com/a/547285/128892

and I added this to includes/application_top.php:

// Bugfix PHP 5.4:
$HTTP_USER_AGENT=$_SERVER["HTTP_USER_AGENT"];
$HTTP_ACCEPT_LANGUAGE=$_SERVER["HTTP_ACCEPT_LANGUAGE"];
$HTTP_HOST=$_SERVER["HTTP_HOST"];
$SERVER_NAME=$_SERVER["SERVER_NAME"];
$PHP_SELF=$_SERVER['PHP_SELF'];
$HTTP_GET_VARS=$_GET;
$HTTP_POST_VARS=$_POST;
register_globals();

comment out this line:

#ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!');

also I had to correct some removed functions in includes/functions/sessions.php: session_unregister() and session_is_registered()


Problem remaining: Items filled into the cart don't get added to the cart. seems like the session isn't known in the add_cart page.


Solution

I cound not fix this last problem, so after trying diffenent attempts I decided to take the effort and convert the shop with all its customisations into oscommerce 2.3 which still runs on PHP 5.4 (up to PHP 5.6).

Note that later, to get oscommerce running on php7 you'll need another fix for mysql functions to fix problems like Undefined function mysql_connect()



Answered By - rubo77
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing