I have not figured out why this happens, the only two reasons are PHP memory limit being exceeded for some reason, or a timeout whilst downloading the .tar file. If you reattempt the upgrade again, for most people it seems to work.
I did check with my hosting provider (Siteground) and here’s their answer to my request , if that can help.
I'd like to begin by saying that there have been no recent changes to the hosting environment.
I've checked the case and I was able to replicate the issue. During this time, I was monitoring the PHP error log, and the following errors were recorded:
[19-Jul-2023 11:41:56 UTC] PHP Fatal error: **Allowed memory size of 805306368 bytes exhausted** (tried to allocate 36864 bytes) in /home/customer/www/mydomain.com/app/Http/Controllers/SelfUpdateController.php on line 76
[19-Jul-2023 11:41:56 UTC] PHP Fatal error: **Allowed memory size of 805306368 bytes exhausted** (tried to allocate 65536 bytes) in /home/customer/www/mydomain.com/vendor/composer/ClassLoader.php on line 576
As I mentionned in my initial post, I’m running PHP 8.1 with 768M memory_limit.
IMO, it should be enough !!
It should definitely be enough memory for this task.
I think this may be a memory leak somewhere prior that is causing this, the most likely spots would be the pre-checks we do prior to unpacking the file.
I have the same issue, also hosted on Siteground and with same parameters. Will try to upload the zip file instead, but @david you mentioned that you would disable the pre-check, does that apply to the current 5.16.19 package or will you disable that for future packages?
I did manually update from 5.16.19 to .21.
Then I tried force update to check if it would reupload and install latest built. It did not work.
I also have a red flag in the Health Check popup.
Seems like Siteground, at least on the plan I’m using for IN, has defaulted to PHP 7.4.
I managed to set in my .htaccess file, a rule that runs IN under PHP8, but this cannot be achieved without command line for CLI. IMO, this defies the purpose of having an automated update process. It seems that this limit has only occured since 5.16.19. Prior to this version was working like a charm.
Same message as initial post :
FormatException: SyntaxError: Unexpected end of JSON input
It may help to increase the server PHP memory limit
So, just to be sure, updates on Selfhost can’t be applied if CLI is not on PHP8 ?
Here is a few comments from Siteground’s support :
Thus, if you like to use Artisan or Composer with a different PHP version like 8.1 you can use the following commands:
Artisan:
php81 artisan Rest of Artisan command
Composer:
php81 /usr/local/bin/composer.phar Rest of the Composer command
I will admit my total ignorance of Artisan and Composer.
Is there anything that can be done on your side to automate these command lines to make them set php8 and to “repair” selfhost updates ?