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.
2
Answers
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()
I’ve had the same problem. Found by comparing my 2.2ms2 code with rc2a version.
In application_top change
to