phpearth / docker-php

🐳 Docker For PHP developers - Docker images with PHP, Nginx, OpenLiteSpeed, Apache, Lighttpd, and Alpine
https://docs.php.earth/docker
MIT License
261 stars 80 forks source link

Manual composer installation failed with error #12

Closed samundra closed 6 years ago

samundra commented 6 years ago

I tried to install composer the usual way from inside the container but it failed with error message.

Docker container: phpearth/php:7.1-cli

Installation Command

$ curl -sS https://getcomposer.org/installer|php

Error reported by the system.

Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The phar extension is missing.
Install it or recompile php without --disable-phar

build docker container based on 7.1-cli tag and try to install composer manually. I tried to do a manual installation so that I can have the latest version of composer but it failed with above error message.

For now I have used the alpine packaged composer version.

petk commented 6 years ago

To be able to run Composer on any PHP, you'll need the following PHP extensions:

And also some other recommended packages in general Linux systems (full complete list):

The composer package from PHP.earth Alpine installs PHP extensions automatically (apk add --no-cache composer)

Otherwise also this will work:

apk  add --no-cache php7.1-phar
curl -sS https://getcomposer.org/installer|php

I'll write more docs on this and check if it can be simplified more. Thanks @samundra for reporting issues.

samundra commented 6 years ago

@petk Thanks for the mentioned packages. I had to use apk add --no-cache composer to finally use composer. I found that it tries to get the latest version which is nice. However I thought I could install it out of the box and was surprised when it didn't.

I think, we should add phar packages by default to our docker boxes.

petk commented 6 years ago

I agree. Phar is sort of essential extension and doesn't add too much to the Docker image (0.3MB ATM). Added via 5c06d4ec1a80958f0f9ee986a0dc23f7cbf2a98d

I'll leave this opened until I fix the Composer docs chapter also...

petk commented 6 years ago

Docker & Composer chapter has been updated: https://php.earth/docs/docker/composer with some more info and usage examples. Closing this. In case there's more that needs to be explained, let me know...