Andrew Fletcher published: 24 January 2022 1 minute read
Running composer on a server... when running the command composer update, screen would error out. In the site directory, composer would show
composer --version
Composer version 1.10.24 2021-12-09 20:06:33
Whereas, the commnd
/opt/plesk/php/7.4/bin/php /usr/lib64/plesk-9.0/composer.phar --version Composer version 2.2.5 2022-01-21 17:25:52
Ok, so composer on the server is running 2.2x. But on my site directory, 1.x
Updating Composer
If I ran the command to update composer from 1.10.x to 2.2.x
composer self-update --2
The process would begin, then drop out shortly afterwards.
Updating to version 2.2.5 (2.x channel). Downloading (100%) [Composer\Downloader\FilesystemException] Filesystem exception: Composer update failed: "/usr/local/psa/var/modules/composer/composer.phar" could not be written. rename(/var/www/vhosts/codebales.com/.composer/cache/composer-temp.phar,/us r/local/psa/var/modules/composer/composer.phar): Permission denied
So I ran a slightly different command, noting the location of composer.phar file.
/opt/plesk/php/7.4/bin/php /usr/local/psa/var/modules/composer/composer.phar selfupdate --2 Updating to version 2.2.5 (2.x channel). Downloading (100%) [Composer\Downloader\FilesystemException] Filesystem exception: Composer update failed: "/usr/local/psa/var/modules/composer/composer.phar" could not be written. rename(/var/www/vhosts/codebales.com/.composer/cache/composer-temp.phar,/us r/local/psa/var/modules/composer/composer.phar): Permission denied
Hmmm, clearly a permission issue.
Change the user the match the permission for the file and try again.
/opt/plesk/php/7.4/bin/php /usr/local/psa/var/modules/composer/composer.phar selfupdate --2
Success
Updating to version 2.2.5 (2.x channel). Downloading (100%) Use composer self-update --rollback to return to version 1.10.24
Cross check composer version in the original site directory... was showing 1.10 and now:
composer --version Composer version 2.2.5 2022-01-21 17:25:52
Related articles
Andrew Fletcher
•
21 Apr 2024
This command will help you spot any unusually large directories
The red flag was when I saw the server disk space is showing a site is taking up 57992.5 MB, where locally the site size is showing 957MB. There is something serious happening here and I need to establish the problem quickly. When dealing with a significant discrepancy in site size...
Andrew Fletcher
•
05 Apr 2024
Drupal 9 to 10 upgrade an example of the actual steps taken
Continuing on from the Drupal 9 to Drupal 10 upgrade outline written earlier... Upgrading Drupal 9 to Drupal 10. However, the point of difference is this article works through the actual action steps of the upgrade.Planning and testing is critical for the Drupal to version 10 process to...
Andrew Fletcher
•
18 Mar 2024
Resolving CVE-2022-48624 less issue
To resolve the CVE-2022-48624 vulnerability on Ubuntu using Nginx, it's crucial to understand that the issue lies within the "less" package, not Nginx itself. The vulnerability affects "less" before version 606, where close_altfile in filename.c in less omits shell_quote calls for LESSCLOSE,...