将操作系统服务器移动到本地服务器


Moving OSCommerce to local server

我正在尝试在本地计算机上设置旧的OSCommerce站点。 我按照这些说明进行操作,但是当我尝试在本地打开网站时,我遇到了一些错误。

我正在使用osCommerce 2.2-MS2。 我的本地PHP版本是5.5.9,安装OSC的远程服务器是PHP版本5.3.2。

当我转到 http://dev.osc.local/ 时,出现以下错误。( !解析错误:语法错误,第 690 行/var/www/osc/index.php 中的文件意外结尾第 690 行是索引的最后一行.php它们是:

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

当我去 http://dev.osc.local/admin 时,我得到致命错误:register_globals在 php.ini 中被禁用,请启用它!

我尝试将.htaccess文件添加到根文件夹和管理员文件夹,但它不起作用。.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

更新

根据 edmondscommerce 的答案,我用正则表达式<'?['s]搜索了<?,发现了 2000 多次出现。

我还更新了application_top.php文件以包括:

if ( ($session_started == true) && (PHP_VERSION >= 4.3) && function_exists('ini_get') && (ini_get('register_globals') == false) ) {
  extract($_SESSION, EXTR_OVERWRITE+EXTR_REFS);
}

我不确定将此代码片段放在文件中的哪个位置,也不确定它是否与下面的部分冲突。

// 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');
  }

如果您查看 osCommerce 的最新副本,您将在 application_top.php 中看到这一行,它执行 osC 工作所需的操作,而无需寄存器全局

extract($_SESSION, EXTR_OVERWRITE + EXTR_REFS);

这会将会话变量提取到实际$variables中,然后可以在其他地方使用。

然后,您需要注释掉或删除实际检查是否启用了寄存器全局变量的行以消除错误。

如果您将其粘贴到应用程序顶部,那么它应该可以工作,或者至少解决您的大部分问题。

您的另一个错误很可能与禁用 PHP 短开放标签有关。你最好的选择是寻找并删除<?样式的PHP标签,并用适当的<?php标签替换。

相关文章: