.htaccess permissions error when trying to Update

Running the command “sudo -u -www-data composer install -o --no-dev” while logged in as the web user, prompts for a sudo password unfortunately.

Previously running just “composer install -o --no-dev” as the web user, did not successfully process the update.

Yes, so to run the command as that particular user, you would need to enter your own sudo password.

So after all of this has been done, can you inspect the VERSION.txt file in the installation directory and see whether it has been updated.

If it hasn’t updated, then the upgrade process has failed between the unzipping, and copying stage.

The VERSION.txt file still shows the original version of 5.2.16. There is now a new update of 5.2.18, and running the update from the website again downloads the update to the /tmp folder, but does not properly upgrade.

Am I able to manually copy the upgrade files from /tmp/v5.2.18 into my install directory and overwrite everything?

EDIT: I manually copied everything from /tmp/v5.2.18 into my install directory, ran “php artisan optimize” and the update completed successfully. If the update is a manual process for me, it’s not the end of the world.

Did you ever resolved this christopher.phillips? I think we have exactly the same setup with ISPConfig.

I didn’t. My “fix” was to start the update in Invoice Ninja, let it fail, and then manually move all the files from /tmp/v5.x.x into my install directory, and then from that directory run “php artisan optimize”. Note: Commands need to be run as the web user, not root. I created a Shell-User in ISPConfig with access to do this.

This still seems to be an issue. Complaints about an open_basedir folder that is in the permission list.

Should i download the package and overwrite all files?

That’s essentially what I have been doing for updates. Download the zip, expand and overwrite files, and then run “php artisan optimize”. Ironically however, the most recent update to v5.3.79 was successful using the built-in update feature. I’m not sure what changed in order for this to work, but it could also be just a one off. Waiting until the next update to see how that goes.

I had this problem, also running ispconfig.

I updated the message to include the path of the file that was the problem:

throw new FilePermissionsFailure("Cannot update system because {$file->getFileName()} {$file->getPath()} is not writable");

My issue was the stats folder that gets created automatically and contains an .htaccess and index.php file which have group:owner of 0.

According to this post it seems fine to delete: https://forum.howtoforge.com/threads/how-to-disable-stats-folder-creation-in-web.79708/

So I removed it (Change to the correct client and site):

sudo rm -rf /var/www/clients/client1/web1/web/stats

And then ran the update again and the checks now pass.
So I guess the problem is that it checks everything in the web directory and not just the files/folders that need to be edited.
Maybe it could skip ‘stats’ and ‘error’ which get added by a few different systems?

I did run into another error after that but it says that v5.5.7 is available and there’s a 404 when it tries to get the zip from github as it doesn’t exist:
https://github.com/invoiceninja/invoiceninja/releases/download/v5.5.7/invoiceninja.zip
So I’m fairly confident that next time it should be fine.

Before I found that problem, I also updated the default php-cli version and then composer (It was showing errors when running manually so probably out of date) as I thought that might be a problem as well.

sudo a2enconf php8.1-fpm
sudo systemctl reload apache2
sudo update-alternatives --set php /usr/bin/php8.1

wget -O composer-setup.php https://getcomposer.org/installer
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
sudo chmod +x /usr/local/bin/composer

UPDATE: Switching php-cli version broke ispconfig’s corn so I had to put it back
sudo update-alternatives --set php /usr/bin/php7.4
I’ll just need to remember to change it again before updating IN.

An easier option:

Edit the site in ispconfig, in the statistics tab, set statistics program to none.