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
•
16 Jan 2025
get IP address from terminal OSX
When troubleshooting network issues or configuring devices, knowing your IP address can be essential. Whether you're connected via Wi-Fi, Ethernet, or tethering through a mobile provider, macOS offers powerful built-in tools to quickly identify your IP address. Here's a practical guide tailored to...
Andrew Fletcher
•
07 Jan 2025
Managing DDEV environment troubleshooting and setting up multiple Drupal projects
DDEV has become a popular tool for local web development, offering a streamlined approach to managing Docker-based environments. However, setting up and managing DDEV projects, particularly with the latest versions of Docker Desktop, can present challenges. This article guides you through resolving...
Andrew Fletcher
•
28 Dec 2024
Optimising file transfers by improving efficiency from cp to rsync
Transferring files between development and production environments is a critical task in the deployment process. However, I continue to come across multiple approaches that scale from awesome automation using pipelines to the basic of direct command line entry. Where the basic approaches rely on...