The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
install userspice in a sub-folder without errors
#1
Thumbs Up 
It's a contribution to others that struggle with using US when it is installed not in the root of your website.

Something goes wrong (error messages in init.php and loading helper.php) and my below solution, that works:

i downloaded the last version of US and place this in a sub-folder: /applic/ 
then starting the install instructions and after that cleanup the install directory.

When using US you got error messages with the helper and init files.

The easiest way to solve this was defining my subfolder hardcoded in the init.php file like below:

$us_url_root="/applic/";
require_once $abs_us_root.$us_url_root.'users/helpers/helpers.php';

then you can remove the lines above because it doesn't work very well and give waist compute time.
what i discover was that the variable $us_url_root first was /applic/ and later was gone and still / 

so my init.php file looks like below:

<?php

require_once 'classes/class.autoloader.php';
session_start();

$abs_us_root=$_SERVER['DOCUMENT_ROOT'];

/*
$self_path=explode("/", $_SERVER['PHP_SELF']);
$self_path_length=count($self_path);
$file_found=FALSE;

for($i = 1; $i < $self_path_length; $i++){
array_splice($self_path, $self_path_length-$i, $i);
$us_url_root=implode("/",$self_path)."/";

if (file_exists($abs_us_root.$us_url_root.'z_us_root.php')){
$file_found=TRUE;
break;
}else{
$file_found=FALSE;
}
}
*/
$us_url_root="/applic/";
require_once $abs_us_root.$us_url_root.'users/helpers/helpers.php';
  Reply
#2
Thanks so much for sharing this.

Just to let you know, I do installs in subfolders all the time and those to URLs let me move installs from folder to folder without having to worry about what folder the install is in.

Unfortunately some servers make it relatively complicated to setup subdomains and depending on whether you use an A record or some type of "forwarding" with your domain registrar, it will have a big impact on how cleanly things work.

The "ideal" way to do this is to setup an A Record with your registrar that just says
xxx.yourdomain.com forwards to an ip.

The add the subdomain to your cpanel or whatever your hosting provider uses and tell it that xxx.yourdomain.com goes to /var/www/yoursite/public_html/whateverfolder

But that isn't always possible. Thanks so much for sharing your workaround. I'm sure it will be helpful to others.
  Reply
#3
my use of US is combining it with other content.
so:
www.domain.com is where my I install Joomla.
www.domain.com/applic/ is where I install US

of course, another way is using:
www.domain.com and
applic.domain.com

@mudmin you do a lot of good work !!! Thanks.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)