I'm trying to set up our old OSCommerce site on my local machine. I followed these instructions but I'm getting a few errors when I try to open the site locally.
I'm using osCommerce 2.2-MS2. My local PHP version is 5.5.9 and the remote server the OSC is installed on is PHP version 5.3.2.
When I go to http://dev.osc.local/ I get the below error. ( ! ) Parse error: syntax error, unexpected end of file in /var/www/osc/index.php on line 690 Line 690 is the last line of index.php and is:
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
When I go to http://dev.osc.local/admin I get FATAL ERROR: register_globals is disabled in php.ini, please enable it!
I've tried adding a .htaccess file to the root folder and the admin folder but It has not worked. .htaccess
# $Id: .htaccess 1739 2007-12-20 00:52:16Z hpdl $
#
# This is used with Apache WebServers
#
# For this to work, you must include the parameter 'Options' to
# the AllowOverride configuration
#
# Example:
#
# <Directory "/usr/local/apache/htdocs">
# AllowOverride Options
# </Directory>
#
# 'All' with also work. (This configuration is in the
# apache/conf/httpd.conf file)
# The following makes adjustments to the SSL protocol for Internet
# Explorer browsers
#<IfModule mod_setenvif.c>
# <IfDefine SSL>
# SetEnvIf User-Agent ".*MSIE.*" \
# nokeepalive ssl-unclean-shutdown \
# downgrade-1.0 force-response-1.0
# </IfDefine>
#</IfModule>
# If Search Engine Friendly URLs do not work, try enabling the
# following Apache configuration parameter
# AcceptPathInfo On
# Fix certain PHP values
# (commented out by default to prevent errors occuring on certain
# servers)
# php_value session.use_trans_sid 0
php_value register_globals 1
UPDATE
Based on edmondscommerce answer I searched for <?
with the regex <\?[\s]
and found over 2000 occurrences.
I also updated the application_top.php file to include:
if ( ($session_started == true) && (PHP_VERSION >= 4.3) && function_exists('ini_get') && (ini_get('register_globals') == false) ) {
extract($_SESSION, EXTR_OVERWRITE+EXTR_REFS);
}
I'm not sure where to put this code snippet in the file and am not sure if it conflicts with the section below.
// check if sessions are supported, otherwise use the php3 compatible session class
if (!function_exists('session_start')) {
define('PHP_SESSION_NAME', 'osCsid');
define('PHP_SESSION_PATH', $cookie_path);
define('PHP_SESSION_DOMAIN', $cookie_domain);
define('PHP_SESSION_SAVE_PATH', SESSION_WRITE_DIRECTORY);
include(DIR_WS_CLASSES . 'sessions.php');
}
If you look at a recent copy of osCommerce you will see this line in application_top.php which does what is required for osC to work, without the need for register globals:
This will extract session variables into actual $variables that can then be used elsewhere.
You will then need to comment out or remove the line that actually checks if register globals is enabled to get rid of your error.
If you paste that into your application top then it should work, or at least solve most of your problems.
Your other error is quite possibly to do with PHP short open tags being disabled. Your best bet here is to hunt down and remove
<?
style PHP tags and replace with proper<?php
tags