Skip to content

Add support for Composer #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
naneau opened this issue Oct 11, 2014 · 4 comments
Closed

Add support for Composer #17

naneau opened this issue Oct 11, 2014 · 4 comments

Comments

@naneau
Copy link

naneau commented Oct 11, 2014

Composer is the de facto package manager for PHP. Nearly all (modern) libraries and frameworks rely on it. The current PHP images do not support it, because the openssl exension is missing. While Composer falls back to the git transport method (see second example below), this may not be available for all packages.

One-liner installation

The "recommended" install method, using a one-liner fails:

Dockerfile:

FROM php:5.5
RUN php -r "readfile('https://getcomposer.org/installer');" | php

Result:

Step 1 : RUN php -r "readfile('https://getcomposer.org/installer');" | php
 ---> Running in 21722cb03536

Warning: readfile(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in Command line code on line 1

Warning: readfile(https://getcomposer.org/installer): failed to open stream: No such file or directory in Command line code on line 1

Manual Installation

Adding it manually (download from https://getcomposer.org/composer.phar) works, but results in warnings. In this case installation proceeds, because git can be used to fetch the source, this may not work for all packages.

Dockerfile:

FROM php:5.5

# Create working dir
RUN mkdir /composer-test

# Manually add composer
ADD composer.phar /composer-test/composer.phar

# Try to install a package
WORKDIR /composer-test
RUN php composer.phar require monolog/monolog

Result:

Step 4 : RUN php composer.phar require monolog/monolog
 ---> Running in 58633ee9c005
Using version ~1.11 for monolog/monolog
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing psr/log (1.0.0)
Failed to download psr/log from dist: You must enable the openssl extension to download files via https
Now trying to download from source
  - Installing psr/log (1.0.0)
    Cloning fe0936ee26643249e916849d48e3a51d5f5e278b

  - Installing monolog/monolog (1.11.0)
Failed to download monolog/monolog from dist: You must enable the openssl extension to download files via https
Now trying to download from source
  - Installing monolog/monolog (1.11.0)
    Cloning ec3961874c43840e96da3a8a1ed20d8c73d7e5aa
@naneau naneau mentioned this issue Oct 11, 2014
@cdams
Copy link
Contributor

cdams commented Oct 14, 2014

The issue

Warning: readfile(): Unable to find the wrapper "https"

was solved with the PR #16

@naneau
Copy link
Author

naneau commented Oct 14, 2014

@cdams enabling ssl will most likely have fixed the second problem as well. I'll test but I think that's all.

@cdams
Copy link
Contributor

cdams commented Oct 15, 2014

If you still have an issue, have a look to my Dockerfile:
https://github.com/cdams/php/blob/add-composer/5.5/apache/Dockerfile

And you can get the docker image here: docker pull cdams/php

++

@naneau
Copy link
Author

naneau commented Oct 15, 2014

@cdams the issue has been resolved with the ssl merge. Look at #8 for a discussion about enabling more modules by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants