Web based family history software

file Question Problem trying to install new instance - got it working, kinda...

  • Gyapuko
  • Gyapuko's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 4 months ago - 1 year 4 months ago #1 by Gyapuko
I'm installing webtrees for the first time, on a raspberry pi connecting to a database on my NAS. I've just gone through the setup wizard, but now when I go to raspberrypi.local/webtrees/ I get a crash with a stack trace:
Code:
Error: Typed static property Fisharebest\webtrees\I18N::$translator must not be accessed before initialization in /var/www/html/webtrees/app/I18N.php:347 Stack trace: #0 /var/www/html/webtrees/app/Validator.php(355): Fisharebest\webtrees\I18N::translate() #1 /var/www/html/webtrees/app/Http/Middleware/BadBotBlocker.php(209): Fisharebest\webtrees\Validator->string() #2 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\BadBotBlocker->process() #3 /var/www/html/webtrees/app/Http/Middleware/CompressResponse.php(73): Middleland\Dispatcher->handle() #4 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\CompressResponse->process() #5 /var/www/html/webtrees/app/Http/Middleware/ContentLength.php(40): Middleland\Dispatcher->handle() #6 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\ContentLength->process() #7 /var/www/html/webtrees/vendor/middlewares/client-ip/src/ClientIp.php(65): Middleland\Dispatcher->handle() #8 /var/www/html/webtrees/app/Http/Middleware/ClientIp.php(47): Middlewares\ClientIp->process() #9 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\ClientIp->process() #10 /var/www/html/webtrees/app/Http/Middleware/HandleExceptions.php(90): Middleland\Dispatcher->handle() #11 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\HandleExceptions->process() #12 /var/www/html/webtrees/app/Http/Middleware/BaseUrl.php(73): Middleland\Dispatcher->handle() #13 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\BaseUrl->process() #14 /var/www/html/webtrees/app/Http/Middleware/ReadConfigIni.php(68): Middleland\Dispatcher->handle() #15 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\ReadConfigIni->process() #16 /var/www/html/webtrees/app/Http/Middleware/SecurityHeaders.php(48): Middleland\Dispatcher->handle() #17 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\SecurityHeaders->process() #18 /var/www/html/webtrees/app/Http/Middleware/EmitResponse.php(57): Middleland\Dispatcher->handle() #19 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\EmitResponse->process() #20 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(118): Middleland\Dispatcher->handle() #21 /var/www/html/webtrees/app/webtrees.php(275): Middleland\Dispatcher->dispatch() #22 /var/www/html/webtrees/app/webtrees.php(262): Fisharebest\webtrees\webtrees::dispatch() #23 /var/www/html/webtrees/index.php(51): Fisharebest\webtrees\webtrees->httpRequest() #24 {main}

When I tried to search for that error text, I found forum posts saying that the error was not setting the config.ini.php correctly (especially not setting the base_url properly), but I'm pretty sure mine is correct:
Code:
; <?php return; ?> DO NOT DELETE THIS LINE dbtype="mysql" dbhost="10.1.1.250" dbport="3306" dbuser="webtrees" dbpass= (redacted) dbname="webtrees" tblpfx="wt_" base_url="http://raspberrypi.local/webtrees" rewrite_urls="0"

What am I doing wrong?
Last edit: 1 year 4 months ago by Gyapuko.

Please Log in or Create an account to join the conversation.

  • Gyapuko
  • Gyapuko's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 4 months ago #2 by Gyapuko
Replied by Gyapuko on topic Problem trying to install new instance
I thought it might be that I hadn't installed php-intl, even though the wizard said it was optional. I've just tried a complete reinstall of webtrees, this time with php-intl installed, and that didn't fix the problem either :(

Please Log in or Create an account to join the conversation.

  • bertkoor
  • bertkoor's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Greetings from Utrecht, Holland
More
1 year 4 months ago - 1 year 4 months ago #3 by bertkoor
Replied by bertkoor on topic Problem trying to install new instance
First line of the stack trace refers to Validator.php line 355 :
Code:
throw new HttpBadRequestException(I18N::translate('The parameter “%s” is missing.', $parameter));

That php file resides in the app folder.
If you change that line to
Code:
throw new HttpBadRequestException('The parameter' . $parameter . ' is missing.');

then you may be able to figure out what parameter exactly is missing.

This is called from BadBotBlocker.php which at line 210 checks eg the user agent string and ip address headers.

Do you perhaps use a super secure browser which does not send any user agent string? webtrees cannot handle that.

stamboom.BertKoor.nl runs on webtrees v2.1.20
Last edit: 1 year 4 months ago by bertkoor.

Please Log in or Create an account to join the conversation.

  • Gyapuko
  • Gyapuko's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 4 months ago #4 by Gyapuko
Replied by Gyapuko on topic Problem trying to install new instance
> Do you perhaps use a super secure browser which does not send any user agent string? webtrees cannot handle that.

Just Firefox!

Yes, it looks like you're right. If I use Edge, it works.

This is, um, not good at all. It's clearly a bug - no other webpage fails this catastrophically in Firefox. Oh well, at least now I know what's going on.

Please Log in or Create an account to join the conversation.

More
1 year 3 months ago #5 by fisharebest
Replied by fisharebest on topic Problem trying to install new instance
> This is called from BadBotBlocker.php which at line 210

The stack dump says line 209

Assuming you are using 2.1.17, here is line 209

github.com/fisharebest/webtrees/blob/2.1...dBotBlocker.php#L209

This is where it fetches the remote IP address - which should have been set earlier.

(FWIW, empty user-agent strings should be fine. I just tested it).

You can probably "suppress" this error by adding a second parameter to the function with a default value (e.g. '1.2.3.4');

But the real question is why the remote IP isn't detected.

We use a third-party library to do this - there is lots of complexity regarding proxies/headers.

The code is in the vendor folder, but you can see it here:
github.com/middlewares/client-ip/blob/v2...src/ClientIp.php#L71

Maybe you can investigate here?

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

More
10 months 2 weeks ago #6 by Møller
Replied by Møller on topic Problem trying to install new instance
message

Please Log in or Create an account to join the conversation.

More
10 months 2 weeks ago - 10 months 2 weeks ago #7 by Franz Frese
Replied by Franz Frese on topic Problem trying to install new instance
I would replace line 382 in ...app/Validator.php(382)
            throw new HttpBadRequestException(I18N::translate('The parameter “%s” is missing.', $parameter));
by
            throw new HttpBadRequestException('The parameter ' . $parameter . ' is missing.', );

meaning you get a untranslated error message.
Last edit: 10 months 2 weeks ago by Franz Frese.

Please Log in or Create an account to join the conversation.

More
10 months 2 weeks ago #8 by Møller
Replied by Møller on topic Problem trying to install new instance
Thanks for the suggestion. I tried it, but unfortunately it leads to another more fundamental error:

Uncaught Error: Call to a member function connection() on null in /var/www/html/webtrees/vendor/illuminate/database/Capsule/Manager.php:87 Stack trace: #0 /var/www/html/webtrees/app/Site.php(152): Illuminate\Database\Capsule\Manager::table() #1 /var/www/html/webtrees/app/Http/Middleware/HandleExceptions.php(155): Fisharebest\webtrees\Site::getPreference() #2 /var/www/html/webtrees/app/Http/Middleware/HandleExceptions.php(98): Fisharebest\webtrees\Http\Middleware\HandleExceptions->httpExceptionResponse() #3 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\HandleExceptions->process() #4 /var/www/html/webtrees/app/Http/Middleware/BaseUrl.php(73): Middleland\Dispatcher->handle() #5 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\BaseUrl->process() #6 /var/www/html/webtrees/app/Http/Middleware/ReadConfigIni.php(68): Middleland\Dispatcher->handle() #7 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\ReadConfigIni->process() #8 /var/www/html/webtrees/app/Http/Middleware/SecurityHeaders.php(48): Middleland\Dispatcher->handle() #9 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\SecurityHeaders->process() #10 /var/www/html/webtrees/app/Http/Middleware/EmitResponse.php(57): Middleland\Dispatcher->handle() #11 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\EmitResponse->process() #12 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(118): Middleland\Dispatcher->handle() #13 /var/www/html/webtrees/app/webtrees.php(275): Middleland\Dispatcher->dispatch() #14 /var/www/html/webtrees/app/webtrees.php(262): Fisharebest\webtrees\webtrees::dispatch() #15 /var/www/html/webtrees/index.php(51): Fisharebest\webtrees\webtrees->httpRequest() #16 {main} thrown

/var/www/html/webtrees/vendor/illuminate/database/Capsule/Manager.php: 87

Please Log in or Create an account to join the conversation.

More
10 months 2 weeks ago #9 by Franz Frese
Replied by Franz Frese on topic Problem trying to install new instance
So that is the untranslated error reason.

Please Log in or Create an account to join the conversation.

More
10 months 6 days ago #10 by Møller
I got it working after opening my webserver to the outside world and then editing config.ini.php in the data-folder and setting base_url to my new internet-adress. Now both firefox and edge can show my webtree without failing. When I try to run webtrees from my local net it still fails with the same error-stack on firefox

Please Log in or Create an account to join the conversation.

  • bertkoor
  • bertkoor's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Greetings from Utrecht, Holland
More
10 months 6 days ago - 10 months 6 days ago #11 by bertkoor
You mean this exact exception?
Code:
Uncaught Error: Call to a member function connection() on null in /var/www/html/webtrees/vendor/illuminate/database/Capsule/Manager.php:87 Stack trace: #0 /var/www/html/webtrees/app/Site.php(152): Illuminate\Database\Capsule\Manager::table() #1 /var/www/html/webtrees/app/Http/Middleware/HandleExceptions.php(155): Fisharebest\webtrees\Site::getPreference() #2 /var/www/html/webtrees/app/Http/Middleware/HandleExceptions.php(98): Fisharebest\webtrees\Http\Middleware\HandleExceptions->httpExceptionResponse() #3 /var/www/html/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\webtrees\Http\Middleware\HandleExceptions->process()


I think the error message means there is no connection with a database. First thing is to check the db properties in your config.ini.php ...
But there could be a "caused by" further down which you might wanna check as well.

stamboom.BertKoor.nl runs on webtrees v2.1.20
Last edit: 10 months 6 days ago by bertkoor.

Please Log in or Create an account to join the conversation.

More
10 months 6 days ago #12 by Møller
The error I get is:
Error: Typed static property Fisharebest\webtrees\I18N::$translator must not be accessed before initialization in /var/www/html/webtrees/app/I18N.php:347
Stack trace:
#0 /var/www/html/webtrees/app/Validator.php(382): Fisharebest\webtrees\I18N::translate()
#1 /var/www/html/webtrees/app/Http/Middleware/BadBotBlocker.php(230): Fisharebest\webtrees\Validator->string()
(...)
When I modified the code to skip the translator-step, it gave the error-stack you mentioned.
I have tried a lot of experimenting with the php-code and the problem seems to be that BadBotBlocker cannot work out where I'm coming from when I use Firefox.
After I went online and modified the base_url to match the internet-view of my server both Firefox and Edge are happy.
But when I use the local URL on my home network (mypi.local/webtrees) I still get the error using Firefox and no errors using Edge (but in Edge it now redirects to my external URL - the "base_url" from config.ini.php).
 

Please Log in or Create an account to join the conversation.

More
10 months 6 days ago - 10 months 6 days ago #13 by fisharebest
> I have tried a lot of experimenting with the php-code and the problem seems to be that BadBotBlocker cannot work out where I'm coming from

The bad-bot-blocker is looking for your IP address, which should have been set earlier - in /app/Http/Middleware/ClientIp.php

But it isn't set. The relevant code is probably this - in the call to parent::getLocalIp()
Code:
$ip = trim($server['REMOTE_ADDR'] ?? '', ''); return self::isValid($ip) ? $ip : null;

Maybe your configuration isn't setting REMOTE_ADDR correctly?

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net
Last edit: 10 months 6 days ago by fisharebest.

Please Log in or Create an account to join the conversation.

More
10 months 6 days ago #14 by Møller
And the strange thing is, that the problem disappears when I run the same webtrees-instance using the same browser (Firefox or IOS-Safari) but from the outside (through no-ip and with altered base_url to match it). I can still reproduce the error running locally - with Firefox but not with Edge. I use the unmodified php-code from the webtrees installation (latest version)

Please Log in or Create an account to join the conversation.

More
10 months 6 days ago #15 by fisharebest
> And the strange thing is, that the problem disappears when I run the same webtrees-instance using the same browser (Firefox or IOS-Safari) but from the outside (through no-ip and with altered base_url to match it). I can still reproduce the error running locally

Then I guess you need to look at your webserver config.

The "REMOTE_ADDR" header is added by your webserver configuration. With nginx, it is added by a line like this in the webserver config:

fastcgi_param REMOTE_ADDR $remote_addr;

I haven't used apache for a while, but guess it has something similar.

Maybe create a php_info() page, and you can see exactly what information is being passed to PHP.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum