When I try to run composer self-update, I get the error:
The file is corrupted (creating archive "/home/heytherejake/.composer/cache/composer-temp.phar" disabled by the php.ini setting phar.readonly).
Please re-run the self-update command to try again.
I have set phar.readonly set to Off (and my phpinfo reflects this), yet the error still occurs. Does anyone know what else might cause this?
update / u / upgrade# In order to get the latest versions of the dependencies and to update the composer. lock file, you should use the update command. This command is also aliased as upgrade as it does the same as upgrade does if you are thinking of apt-get or similar package managers.
To solve the Memory exhausted issue, you can try running composer with an Unlimited memory flag like this: php -d memory_limit=-1 /usr/local/bin/composer [COMMAND] or php -d memory_limit=-1 composer. phar [COMMAND] when using a local composer. If that doesn't help, you can upgrade your hosting plan.
Try clearing Composer's cache by running composer clear-cache . Ensure you're installing vendors straight from your composer. json via rm -rf vendor && composer update -v when troubleshooting, excluding any possible interferences with existing vendor installations or composer. lock entries.
The best solution is to remove composer and then reinstall it:
i. Find Composer:
which composer
ii. Then remove it as sudo (use the directory returned from above)
sudo rm -rf /usr/local/bin/composer
sudo rm -rf ~/.composer/cache/
iii. Then install it using apt-get
sudo apt-get update
sudo apt-get install curl php5-cli git
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
iv. Then test if it's working
composer self-update
Composer not updating or working properly is usually due to one of two things. Bad permission and/or bad cache.
To Remove cache, use sudo rm -rf ~/.composer/cache/
To fix permission issue change composer.phar permission to 755:
which composer
sudo chmod 755 path/to/composer
as a last mean of fixing this issue, try to update with sudo sudo -H composer self-update
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With