【发布时间】:2015-06-17 09:20:32
【问题描述】:
我正在尝试在我的本地计算机上设置我们旧的 OSCommerce 站点。我关注了these instructions,但是当我尝试在本地打开网站时遇到了一些错误。
我正在使用 osCommerce 2.2-MS2。我的本地 PHP 版本是 5.5.9,安装 OSC 的远程服务器是 PHP 版本 5.3.2。
当我转到 http://dev.osc.local/ 时,我收到以下错误。 ( ! ) 解析错误:语法错误,第 690 行 /var/www/osc/index.php 中的文件意外结束 第690行是index.php的最后一行,是:
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
当我去 http://dev.osc.local/admin 我得到 致命错误:在 php.ini 中已禁用 register_globals,请启用它!
我尝试将 .htaccess 文件添加到根文件夹和 admin 文件夹,但没有成功。 .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);
}
我不确定将这段代码 sn-p 放在文件中的哪个位置,也不确定它是否与下面的部分冲突。
// 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');
}
【问题讨论】:
-
看起来与您的 PHP 版本不兼容。
register_globals在 PHP 5.4 中被删除 -
@HoboSapiens,谢谢我使用的是 PHP 5.5.9,安装 OSC 的远程服务器是 PHP 5.3.2。你能想到这个吗?
-
如果您的应用程序需要
register_globals并且它不再存在那么不,我想不出除了安装较低版本的PHP 之外的解决方法。而且我不知道你会在哪里得到一个。 -
您需要将会话提取位放在会话开始的位之后
标签: php .htaccess oscommerce