I am hosting InvoiceNinja on Siteground and I got into trouble after update to 5.5.2 and php 8.1 (from 7.4). I changed PHP to 8.1 and inside Health Check I see two PHP versions: web 8.1 and cli 7.4. If I try to upgrade, I get two errors:
FormatException: SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
and later
500: <br /> <b>Fatal error</b>: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 7.4.30. in <b>/home/customer/www/X/public_html/vendor/composer/platform_check.php</b> on line <b>24</b><br />
I found somewhere that this can be solved editing .htaccess but I can’t find what to change. Can someone help where to go from here?
which php81
alias php81='/usr/local/php81/bin/php-cli'
After that php -v showed php 8.1 version, but System Chek in IN was still reporting that cli php version is 7.4.30.
After that they cleared all levels of server-side cache and now I am stuck at login screen with 500: Server Error
In logs I have this error:
[2022-07-29 09:47:47] production.ERROR: Declaration of Egulias\EmailValidator\Validation\MessageIDValidation::isValid(string $email, Egulias\EmailValidator\EmailLexer $emailLexer): bool must be compatible with Egulias\EmailValidator\Validation\EmailValidation::isValid($email, Egulias\EmailValidator\EmailLexer $emailLexer) {"userId":1,"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Declaration of Egulias\\EmailValidator\\Validation\\MessageIDValidation::isValid(string $email, Egulias\\EmailValidator\\EmailLexer $emailLexer): bool must be compatible with Egulias\\EmailValidator\\Validation\\EmailValidation::isValid($email, Egulias\\EmailValidator\\EmailLexer $emailLexer) at /home/customer/www/X/public_html/vendor/egulias/email-validator/src/Validation/MessageIDValidation.php:23)
[stacktrace]
#0 {main}
"}
Now I did two new test installations in subfolder and:
5.5.3 returned error when I tried to run setup Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 7.4.30. in /home/customer/www/X/public_html/test1/vendor/composer/platform_check.php on line 24
It looks like InvoiceNinja still sees php 7.4.
I reversed php settings back to 7.4 and I can login now, but only on another computer, on first one I am still getting 500 error, even if I completely clear cache.
I also find out that fresh instalation (IN 5.4) works if I add /public/setup instead of just /setup.
Question is still, how to do an upgrade to 5.5. Unfortunatelly I am on shared hosting so I am a bit limited on what I can do. It seems like composer only sees original php version and what was tried so far doesn’t change that.
My shared hoster is asking for more details on how InvoiceNinja is using CLI. I can manually choose the CLI PHP version by executing php81 [command], but not set PHP 8.1 as standard, as this would affect all their other customers too. Can you give us some more hints on that? I assume that many IN users are on a shared hosting.
There are errors in laravel.log, but not after running /update:
We don’t actually use the CLI at all except in one place where we report the version of the CLI the system sees. In shared hosting this may well give a false positive.
As long as your cron executes the correct version of PHP (in this case 8.1 for v5.5) then you can ignore what is being reported in the health check.
The error above does looks strange. In this particular case, i would suggest downloading the latest release and overwriting your existing files and then try to load again.
No, I am still having problems, but I don’t have much time lately. Hopefully I’ll try again tomorrow.
I tried /update link, but nothing changed (I didn’t check logs) and the weird part is, that IN is working fine on home computer (meaning I can login and use it) but not on computer on which I first tried to do update, this is where I get error 500 when trying to login. Tried on three browsers (FF, Chrome, Edge).
This goes only for logging in, so far I haven’t tried to update again, because I still see php-cli version 7.4, even if I use alias command and point it to 8.1.