When I try to do:
$ sudo php composer.phar update
I get this warning:
Warning: This development build of composer is over 30 days old. It is recommended to update it by running "composer.phar self-update" to get the latest version.
When I type:
$ sudo php composer.phar self-update
$ sudo php composer.phar update
the warning disappear, but the next time I want to execute the same command (not after 30 days), the warning comes again. How can I solve it?
My guess is that something else overwrites your composer.phar with an old copy. If the self-update process was failing, then you would still see the warning when doing an update right after. If you don't then something must be happening in the meantime.
You can use php composer.phar -V to see the exact version of the phar you have. You could check after a self-update and check after a while again to see if the version changed. Maybe it's checked out in git or you have a build process reverting it or something?
Related
Composer keeps removing the files just after it installs them!
I used composer create-project otra/skeleton --remove-vcs otra-user -vvv to debug and it shows things like :
- Installing otra/otra (1.0.0-alpha.2.4.0): Extracting archive
Executing async command (CWD): unzip -qq -o '/var/www/html/perso/otra-user/vendor/composer/tmp-ad5334fdc8c968f8ad3d54814c2b67c1' -d '/var/www/html/perso/otra-user/vendor/composer/cc30fdc4'
Executing command (CWD): rm -rf '/var/www/html/perso/otra-user/vendor/otra/otra'
Executing command (CWD): rm -rf '/var/www/html/perso/otra-user/vendor/composer/cc30fdc4'
And as usual since a few months, it finished with the infinite loop that shows :
2 packages you are using are looking for funding.
Use the composer fund command to find out more!
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Composer works like a charm before, I do not know what they have changed so I have all those issues now.
I have updated my Composer version and I did a composer diagnose but it shows nothing wrong.
I am using Composer 2.0.12 and PHP 8.0.3.
Thanks to #yivi that pointed me to an another problem in composer.json where I indeed did a loop...
I solved my problem replacing #otra-update by #otra-init in post-install-cmd and post-update-cmd which was what I really wanted to do.
Thanks for your time #Nico Haase and #yivi :)
When I run ...
composer install
... on a server with PHP and nginx installed.
I get the following exception:
[ErrorException]
"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
How can I fix this?
This is a new warning introduced in PHP 7.3.
It means you are not allowed to have a continue statement inside of a switch, you should use break instead.
To fix this you most likely just have to update composer, this can be done simply by running composer self-update.
You can also just run php without warnings, this can be done by setting the ini config values as a start parameter.
php -d error_reporting=0 composer.phar
Check your current PHP version if it's greater than 7.2, then execute follow below simple steps
1. Disable the latest php version
sudo a2dismod php7.3
2. Restart the nginx service
sudo service nginx restart
3. If you are using Apache2 run as below
sudo service apache2 restart
4. Set alternatives
sudo update-alternatives --set php /usr/bin/php7.2
5. Check the PHP version
php -v
6. Now, Install Composer as below
composer install
Old composer uses continue statement in their code within the switch which is outdated and cannot be used anymore with latest version of php.
you need to update your composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --install-dir=bin
for more details visit composer download
It was because of an outdated composer. After searching a lot finally the following works for me:
Uninstall the old composer.
Install a new updated composer.
You can download or install composer from this link: https://getcomposer.org/download/
For me,
just go to this file
sudo nano /usr/share/php/Composer/DependencyResolver/RuleSetGenerator.php
As a quick and dirty alternative, you can fix the error in that file. Just replace "continue" with "break"
Good day, I would like to ask some help, had a problem on composer update.
Here is the picture
but when I check using php -v, it says the php version is 7.1.21.
I really don't know what to do.
Try php composer.phar update.
Your "composer" could be an alias and it's probably pointing to a php 7.0 installation. Check using alias composer
Does it make any difference between updating by composer.phar self-update and just replacing composer.phar with a newer version (e.g. with curl -sS https://getcomposer.org/installer | php)?
I'm asking this since composer.phar self-update makes some problems and I thougt then I will just download a new version. But I'm also wondering if it's just about replacing one single file, why is self-update implemented as well? What is the benefit of using this routine?
The process is different, but the result is the same. Using the most recent composer phar file.
The benefits are in easier access. To update, I just type composer like I always do when install/update/require new packages, then add self-update.
Also when I forget the command, just run composer and command list is printed.
One more reason is it's common command in PHAR file ecosystem. PHPUnit, PhpCsFixer and many other have the same command.
My mac is installed with composer and it works fine. I then clone a laravel project. When I run composer update, some of the dependencies require some php stuff to be downloaded first, like php53-mcrypt. After installing the php stuff, i ran composer update again, it returns a bunch of question marks. A bit of googling returns me answers that require to set the
detect_unicode=Off
in the php.ini. Set it off but still the same. Reinstall composer with the following command
curl -s getcomposer.org/installer | php -d detect_unicode=Off
Still the same. Anyone can help?
Apparently, I had to make sure I added the detect_unicode = off in the correct php.ini file. Reinstall composer with homebrew again and it works.