It looks like composer is missing from the image entirely - sudo find / -name '*composer*' returns no results. Too bad the default docs and setup are broken! For now, I’m manually adding composer to our jobs since it makes more sense to use the circleci images.
This slightly different method (still multiple lines) worked for me to get composer downloaded to the image and in the “right” place (/usr/local/bin/).
Might this just be an issue with some of our older PHP images? I ran some builds using the image tags currently listed in Docker Hub and Composer seems to be available in those. Just not in circleci/php:7.1.5-browsers as noted above.
It might be worth editing the default config.yml that circle-ci provides, as it doesn’t work. I had to use image: circleci/php:7.1-cli and run: vendor/bin/phpunit.
Well, I created a new project and followed he wizard, which creates a config.yml file. That file referred an image, which doesn’t have composer, yet it tried to call composer and so fails. Changing the image to circleci/php:7.1-cli as you suggested, fixes that. It also tries to run phpunit, which - again - is missing. Using vendor/bin/phpunit obviously only works if I add phpunit to the composer.json file, so perhaps it would have been even better to install it globally.
@FelicianoTech, any update on having this bug fixed? As a new user to circleci, it was frustrating to have this come up almost immediately when trying out your product.
If you have gotten Composer to work, then could you just install PHPUnit as part of your build?
For what it’s worth, I’m using Docker anyway, so I install everything I need either in the CI config or inside my Docker image. It’s a bit more work up-front, but there is very little to go wrong in CI terms, so it means I can fix everything myself. Would that approach work for you?
I definitely know that if you’re using a up-to-date image from circleci/php, it has Composer. As for PHPUnit, I would be surprised if upstream installed it. @rohara Do we?
@FelicianoTech@rohara, ok, that makes sense, but then you shouldn’t have your default config list it if you’re not sure that your users will have it running yet, if at all (there are other options, though not popular). It should be commented out, or at least commented, e.g. “// Comment out the following line if you do not yet have PHP unit installed via composer”