Hi there,
working on moving old friendica sites from a shared hosting to a VPS, I ran into the following problem I can't find a solution for. This actually happens with one 2021.04 instance but not with another (anymore), so I'm crosschecking all the settings but can't find how to solve this. Both sites were installed as 2012.04 from the start:
not working version wrote:
This is Friendica, version 2021.04 that is running at the web location sub.domain.com/var/www/subdomaincom. The database version is 1413/1413, the post update version is 1400/1400.
working version wrote:
This is Friendica, version 2021.04 that is running at the web location sub.domain.com. The database version is 1413/1413, the post update version is 1400/1400.
As visible in the screen, the site also displays the following path on top of the page, and of course calls that URL:sub.domain.com/var/www/subdomaincom
Different intents to fix this by changing or deleting the following settings from the console didn't work out:
system.basepath => /var/www/domaincom
system.urlpath => /var/www/domaincom/
Even more astonishing, sending the following setting with the console:/bin/console config system url https://sub.domain.com
.. the site is displayed and works as it should be for a few minutes, and than falls back into the wrong behavior, like if the worker changes something when ever the cron kicks in. In that time span I can log in and even go thru the admin settings but this setting is not available.
Intents to modify the following specifications in local.config.php didn't work out either:
'system.basepath' => '',
'url.basepath' => '',
'system.urlpath'=> '',
url.
and system.
actually shouldn't be used at all as:'config' => [
],
'system' => [
],
I found this conversation by @Hypolite Petovan on github:
Table config, cat = "system" AND key = "basepath"
and it actually looks like this is exactly te problem but I have no experience at all with mysql over CLI SSH and don't know what commands to use to delete the apparently wrong setting in the DB.
Is there a way to delete entries with bin/console
?
I did manage to change some settings from there but couldn't find any hint how to "delete" an entry entirely from there:
bin/console config system basepath /
system.basepath <= /
What do you mean by "works for a few minutes"? How many pages correctly show in the mean time? What happens when the few minutes have elapsed?
The site works correctly for several minutes.
I can log in.
All pages show correctly, including admin pages.
Once it falls back to redirecting to:
sub.domain.com/var/www/subdomain/
.. I have to execute again:/var/www/subdomaincom/bin/console config system url https://sub.domain.com
.. the console prints (as always):system.url <= https://sub.domain.com
and I can use the site again for several minutes before it falls back to the wrong behavior.
@utopiArte Once you set a config value using the console, changing the value in the config file won't help as the console stores the value in the DB and it has precedence over the files.
No matter how you did it, the important part is that system.basepath
must be set to the install folder, and system.url
must be set to the full URL. You can verify what the current value used by Friendica for either config keys is using the console.
I've browsed https://inversion.tupambae.com
and when the style is missing, the first line shows inversion.tupambae.com/var/www/inversioncom
even though it should show https://inversion.tupambae.com
. This is governed by the system.url
config key.
To me it "feels" that /var/www/subdomaincom
is added by some mecanism to sub.domain.com
. In particular because when setting specifically with the console command /var/www/subdomaincom/bin/console config system url
-> https://sub.domain.com
it works for some minutes.
As last intent I tried to use the following commands to reset the two mentioned settings but the behaviour ist still the same:/var/www/subdomaincom/bin/console config system url https://sub.domaincom
/var/www/subdomaincom/bin/console config system basepath /var/www/subdomaincom/
Can't see a solution for this.
No I can't.
There is no change at all in the results of the bin/console config output (print).
Actually even the settings send and "officially" accepted by the system do not show up in the print.
Latest thing I tried, totally feed up, was to send the commands several times and also making sure they end with a slash.
So I send:/var/www/subdomaincom/bin/console config system url https://sub.domain.com/
system.url <= sub.domain.com//var/www/subdomaincom/bin/console config system basepath /var/www/subdomaincom/
system.basepath <= /var/www/subdomaincom//var/www/subdomaincom/bin/console config system url https://sub.domain.com/
system.url <= sub.domain.com//var/www/subdomaincom/bin/console config system basepath /var/www/subdomaincom/
system.basepath <= /var/www/subdomaincom/
And right now it looks like it sticked, for now the site remains operative!
🙄
(please have in mind that this is 2021.04, if it weren't so outdated I'd say we need to figure out the problem because this feels like a real problem under the hood)
/var/www/subdomain/
gets prepended in the URL. Do you mind running bin/console config system
and send the output to hypolite@mrpetovan.com
?Well now strangely on both sites bin/console config
doesn't work anymore.
Both throw the following error message:
rootName@VPShosting:# /../doamincom/bin/console config
PHP Fatal error: Uncaught Error: Undefined constant "CURLE_OPERATION_TIMEOUTED" in /../domaincom/boot.php:229
Stack trace:
#0 /../doamincom//vendor/composer/autoload_real.php(69): require()
#1 /../doamincom//vendor/composer/autoload_real.php(59): composerRequireFriendica()
#2 /../doamincom/vendor/autoload.php(7): ComposerAutoloaderInitFriendica::getLoader()
#3 /../doamincom/bin/console.php(31): require('...')
#4 {main}
thrown in /../doamincom/boot.php on line 229
Can't recall doing anything at all, accept trying to get the php imap module to work.
@utopiArte There's no file named boot.php
at the root of the Friendica install, not sure where it's coming from.
The CURLE_OPERATION_TIMEOUTED
constant is defined by the PHP curl extension, please verify it is enabled in the CLI version of php with php -i | grep curl
.
@Hypolite Petovan
After a break I started to check out everything again and did several tests.
I changed the order of the lines in local.config.php and managed to get the exact same lines and order in the bin/console prints of both sites.
The problem stayed.
Than I checked example_local.config.php to compare and found that actually any of the lines figure there, so I deleted them all together.
Right now local.config.php looks like this:
The site still behaves the same way. At first it loads correctly, and quite fast, after some minutes it starts taking lot's of time and ends up like in the screen of the initial post.
Now the bin/console config print shows only the following two specific lines related to the whole path issue, all the other references mentioned above are gone.
I have no idea how to delete the remaining references. Those lines have to figure somewhere in the DB I guess, but again, no idea what lines to execute to display them or delete them:
config.system.basepath => /
system.basepath => /var/www/subdomain