ElkArte Community

Project Support => Support => Topic started by: sottwell on February 11, 2016, 07:08:44 am

Title: Installation in Subdirectory
Post by: sottwell on February 11, 2016, 07:08:44 am
Is it even possible to install ElkArte in a subdirectory? All of the assets, the CSS and Javascript and Image files, have bad URLs. I tried running the repair_settings script, but that didn't help.

Code: [Select]
	<link rel="stylesheet" href="/css/index.css" id="index.css" />
Title: Re: Installation in Subdirectory
Post by: Flavio93Zena on February 11, 2016, 07:18:17 am
It looks like it's missing a $themedir there, but why, is the most important part. What did you do *exactly*, please?
Title: Re: Installation in Subdirectory
Post by: emanuele on February 11, 2016, 07:28:59 am
Hi sottwell and welcome to elk.net. :)

Indeed, all the css, images and javascript should use a filly qualified URL, including domain and paths (see this very forum that is installed in a subdirectory of the domain).
I get you installed "fresh", so conversion problems can be excluded.
What version of php are you running?
Do you have any cache system installed?

May you try (for testing) to enable the minify of javascript and css you find in admin > config > features and options > general and then tick the option "Minify Javascript and CSS files".
Title: Re: Installation in Subdirectory
Post by: sottwell on February 11, 2016, 07:55:13 am
Quote from: Flavio93Zena (#OpIsis) – It looks like it's missing a $themedir there, but why, is the most important part. What did you do *exactly*, please?
I simply installed it, then when it came up with the root URLs, ran the repair_settings.php script and selected all the recommended paths and URLs. No change.
Title: Re: Installation in Subdirectory
Post by: sottwell on February 11, 2016, 07:57:41 am
It doesn't even let me log in at all. I will wipe it out and try installing again.

I am well aware of the issues that can arise from compressing the css and the js; I always disable those features whenever possible.

Perhaps I should say that I'm a web developer, with 10 years experience working with the MODX CMS, as well as the Vanilla and the SMF forums.

I'll try installing it on another dev site in the root and see what happens.
Title: Re: Installation in Subdirectory
Post by: sottwell on February 11, 2016, 08:33:49 am
Ok. I installed it on a new dev server, nothing unusual except setting the database server to be 127.0.0.1

Now I'm getting URLs for assets like
Code: [Select]
http://127.0.0.1/elkarte/themes/default/css/index.css

But at least it lets me log in.

Title: Re: Installation in Subdirectory
Post by: sottwell on February 11, 2016, 08:44:00 am
Ok, I tried it on localhost and it works fine, so it must be something about the hosting. It was nginx servers, with built-in rewrite rules that probably conflict. Just to be clear, I was attempting to install it on the MODX Cloud hosting service, which I use for development sites.

Just to make things interesting, SMF, Vanilla, Grav, phpMyAdmin, even WordPress, install just fine alongside or instead of the default MODX installations.

PHP 5.6.15, MySQL 5.6.28-76.1

Working on finding out what the supplied nginx rewrite rules are.
Title: Re: Installation in Subdirectory
Post by: emanuele on February 11, 2016, 09:45:58 am
From what you are describing it looks like the "usual" issue (that should have been fixed a long while ago) regarding opcache in php 5.6.

Would you mind trying the following change?
In install.php, find:
Code: [Select]
	if (function_exists('opcache_invalidate'))
opcache_invalidate(dirname(__FILE__) . '/Settings.php');
and change it to:
Code: [Select]
	if (function_exists('opcache_invalidate'))
opcache_invalidate(dirname(__FILE__) . '/Settings.php', true);
Title: Re: Installation in Subdirectory
Post by: sottwell on February 11, 2016, 10:28:23 am
Quote from: emanuele – From what you are describing it looks like the "usual" issue (that should have been fixed a long while ago) regarding opcache in php 5.6.

Would you mind trying the following change?
In install.php, find:
Code: [Select]
	if (function_exists('opcache_invalidate'))
opcache_invalidate(dirname(__FILE__) . '/Settings.php');
and change it to:
Code: [Select]
	if (function_exists('opcache_invalidate'))
opcache_invalidate(dirname(__FILE__) . '/Settings.php', true);

Will do.
Title: Re: Installation in Subdirectory
Post by: sottwell on February 11, 2016, 10:43:34 am
Nope. No go. Still using 127.0.0.1 as the domain for the assets URLs.

http://bb.sottwell.modxcloud.com/elkarte/index.php

I found some of them in the database and corrected them, but that doesn't solve where the base URL is defined.
Title: Re: Installation in Subdirectory
Post by: sottwell on February 11, 2016, 11:11:42 am
Are you taking that setting in the installation for the database server, and using that as the site base URL? If that is the case, that's not a very good idea. I work with a number of sites where the database is on a completely different server.
Title: Re: Installation in Subdirectory
Post by: emanuele on February 11, 2016, 03:10:13 pm
During the installation you are asked to provide the url of the forum. Elk installer tries to guess it based on the what it can find, but if the guess is wrong you can correct it.

The problem here, with the 127.0.0.1, looks like the opcache one (as I said before), but what sounds strange to me is the fact SMF installs without errors, because it doesn't even have the opcache invalidation and has suffered of this problem since a long time and it should fail 99% of the times (unless by chance the server has a temporary slowdown between the moment the file is written and the moment is included and in the meantime the opcache catches up and replaces the Settings.php file).

When you use repair_settings, are you able to set the correct url for the themes?