osCommerce doesn't work on PHP5??? Seriously???

Stupid osCommerce is still living in the dark ages, using things like register_globals and $HTTP_POST_VARS - come on guys - get with the program! Following my theme of being forced to fix every program I try to use, I have patched osCommerce 2.2 Milestone 2 Update 060817 to work with PHP 5. Luckily this is an easy fix. First download it from the link above and install the Register Globals Patch (look for VV 1.5 - ZIP Archive).

Now that we have that issue solved we just need to fix the $HTTP_*_VARS issue - these are old school PHP3 variables that were included in PHP4 for compatibility.

Copy this and put it in a file called php5fix.php in your catalog/includes directory:

<?php
// PHP5 Fix by Steve Kamerman, http://www.teratechnologies.net/stevekamerman

$phpversion = explode('.', phpversion());
if((int) $phpversion[0] >= 5){
// PHP 5 has no idea what this crap is
$HTTP_GET_VARS = &$_GET;
$HTTP_POST_VARS = &$_POST;
$HTTP_REQUEST_VARS = &$_REQUEST;
$HTTP_SESSION_VARS = &$_SESSION;
$HTTP_COOKIE_VARS = &$_COOKIE;
$HTTP_SERVER_VARS = &$_SERVER;
$HTTP_FILES_VARS = &$_FILES;
$HTTP_ENV_VARS = &$_ENV;
}
?>

Now edit catalog/admin/includes/application_top.php and add this just below the comments at the top:

// PHP5 fix
require_once("../includes/php5fix.php");

Edit catalog/includes/application_top.php and add this just below the comments at the top:

// PHP5 fix
require_once("includes/php5fix.php");

If you haven’t completed the installation yet, do this too: Edit catalog/install/application.php and add this just below the comments at the top:

// PHP5 fix
require_once("../includes/php5fix.php");

Now you should be good to go! I’ll take a bow and pat myself on the back now - have a nice day :D

P.S. I suppose I could fix up a fresh installation and provide you with a link to download it from if you want. Somebody please email me if you want it, otherwise I’m wasting my time.

stevekamerman

COO @scientiamobile