xoops forums

kavehj

Just popping in
Posted on: 10/29 6:03
kavehj
kavehj (Show more)
Just popping in
Posts: 3
Since: 10/17 8:29
#1

Xoops restore problem

Hello
I had a website which designed by Xoops. I have restore it's backup files on a new server.
When i want to visit it in browser, i see this error:
XOOPS path check: Script is not inside XOOPS_ROOT_PATH and cannot run.

I have changed mainfile.php. Currently this file's codes are like next post (I changed sensitive information to xxxx)





I have searched and found some solution, but none of them worked for me. These solutions were:
1: Change
define('XOOPS_CHECK_PATH', '1');
to:
define('XOOPS_CHECK_PATH', '0');

After doing this, this messade:
"XOOPS path check: Script is not inside XOOPS_ROOT_PATH and cannot run."
disappears. But the page can not load and i see "HTTP ERROR 500".

2: I have tried this solution too:
https://github.com/XoopsDocs/xoops-2.5 ... ree/master/en/book/moving

But i can not run srdb on my website. When i want to load srdb, i see this error again.

How can i solve this problem?

kavehj

Just popping in
Posted on: 10/29 6:05
kavehj
kavehj (Show more)
Just popping in
Posts: 3
Since: 10/17 8:29
#2

Re: Xoops restore problem

<?php
// $Id: mainfile.dist.php,v 1.7.6.3 2005/05/21 15:38:20 mithyt2 Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <http://www.xoops.org/> //
// ------------------------------------------------------------------------ //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //

if ( !defined("XOOPS_MAINFILE_INCLUDED") ) {
define("XOOPS_MAINFILE_INCLUDED",1);

// XOOPS Physical Path
// Physical path to your main XOOPS directory WITHOUT trailing slash
// Example: define('XOOPS_ROOT_PATH', 'D:/eorg/sha');
define('XOOPS_ROOT_PATH', '/sha');

// XOOPS Virtual Path (URL)
// Virtual path to your main XOOPS directory WITHOUT trailing slash
// Example: define('XOOPS_URL', 'http://eorg.ut.ac.ir/sha');
define('XOOPS_URL', 'xxxx');

define('XOOPS_CHECK_PATH', '1');
// Protect against external scripts execution if safe mode is not enabled
if ( XOOPS_CHECK_PATH && !@ini_get('safe_mode') ) {
if ( function_exists('debug_backtrace') ) {
$xoopsScriptPath = debug_backtrace();
if ( !count($xoopsScriptPath) ) {
die("XOOPS path check: this file cannot be requested directly");
}
$xoopsScriptPath = $xoopsScriptPath[0]['file'];
} else {
$xoopsScriptPath = isset($_SERVER['PATH_TRANSLATED']) ? $_SERVER['PATH_TRANSLATED'] : $_SERVER['SCRIPT_FILENAME'];
}
if ( DIRECTORY_SEPARATOR != '/' ) {
// IIS6 may double the \ chars
$xoopsScriptPath = str_replace( strpos( $xoopsScriptPath, '\\\\', 2 ) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $xoopsScriptPath);
}
if ( strcasecmp( substr($xoopsScriptPath, 0, strlen(XOOPS_ROOT_PATH)), str_replace( DIRECTORY_SEPARATOR, '/', XOOPS_ROOT_PATH)) ) {
exit("XOOPS path check: Script is not inside XOOPS_ROOT_PATH and cannot run.");
}
}

// Database
// Choose the database to be used
define('XOOPS_DB_TYPE', 'mysql');

// Table Prefix
// This prefix will be added to all new tables created to avoid name conflict in the database. Please change this to something different than 'xoops'.
define('XOOPS_DB_PREFIX', 'xxxx');

// Database Hostname
// Hostname of the database server. If you are unsure, 'localhost' works in most cases.
define('XOOPS_DB_HOST', 'localhost');

// Database Username
// Your database user account on the host
define('XOOPS_DB_USER', 'xxxx');

// Database Password
// Password for your database user account
define('XOOPS_DB_PASS', 'xxxx');

// Database Name
// The name of database on the host. The installer will attempt to create the database if not exist
define('XOOPS_DB_NAME', 'xxxx');

// Use persistent connection? (Yes=1 No=0)
// Default is 'No'. Choose 'No' if you are unsure.
define('XOOPS_DB_PCONNECT', '0');

define('XOOPS_GROUP_ADMIN', '1');
define('XOOPS_GROUP_USERS', '2');
define('XOOPS_GROUP_ANONYMOUS', '3');

//uncomment this after installing protector module
//include(XOOPS_ROOT_PATH.'/modules/protector/include/precheck.inc.php');
if (!isset($xoopsOption['nocommon']) && XOOPS_ROOT_PATH != '') {
require XOOPS_ROOT_PATH."/include/common.php";
}
//uncomment this after installing protector module
//include(XOOPS_ROOT_PATH.'/modules/protector/include/postcheck.inc.php');
}
?>

kakos

Friend of XOOPS
Posted on: 10/29 11:17
kakos
kakos (Show more)
Friend of XOOPS
Posts: 73
Since: 2002/6/6 2
#3

Re: Xoops restore problem

When you migratate a xoops site, you should update some options in mainfile.php.

define('XOOPS_ROOT_PATH', '/path/to/xoosROOT');

define('XOOPS_PATH', '/path/to/xoops_lib');

define('XOOPS_VAR_PATH', '/path/to/xoops_data');

define('XOOPS_URL', 'http://mydomain_OR_ip');

xoops_lib and xoops_data (do not forget this directories) by default located in the root folder but it is recommended to move out of the root.

If there are changes to the database (host dbname user etc), the xoops_data/data/secure.php should be updated with these.

If this is a public site it is useful to give us a domain.

Costas