Skip to main content

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 Fletcher18 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,...