Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jgravois's avatar

Need to upgrade to composer 2 on Forge server

I am running production on Digital Ocean via Forge ... the current composer version is 1.10.19 ... I can't composer self-update --2 because of this

[Composer\Downloader\FilesystemException]
  Filesystem exception:
  Composer update failed: "/usr/local/bin/composer" could not be written.
  rename(/home/forge/.composer/cache/composer-temp.phar,/usr/local/bin/composer): Permission denied

I am not a "server guy" so would love safe suggestion.

I found this but not sure if it is safe for Forge server

composer
sudo apt-get remove composer
cd ~
curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
0 likes
4 replies
Tray2's avatar
Tray2
Best Answer
Level 73

You should be able to run sudo composer self-update

2 likes
Tray2's avatar

Please mark the thread as solved.

rhand's avatar

Did a sudo composer self-update --2 so I could work with the latest and get Github oauth key to work

Please or to participate in this conversation.