8000 Minimum required set to get up and running on Heroku fails: Package is not installed: ext-mongo-1.6.12.0 · Issue #67 · alcaeus/mongo-php-adapter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Minimum required set to get up and running on Heroku fails: Package is not installed: ext-mongo-1.6.12.0 #67

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
holtkamp opened this issue Feb 16, 2016 · 25 comments

Comments

@holtkamp
Copy link

As Heroku is quite fast with adopting PHP 7, I am looking at using this.

After reading #58 and #30 I came up with a short test but even the most basic composer.json fails to install:

{
  "provide": {
    "ext-mongo": "1.6.12"
  },
  "require": {
    "alcaeus/mongo-php-adapter": "dev-master"
  }
}

Results in

composer selfupdate

Updating to version 93501a5e3f8433e982da3518e13896ee4c0e816b.
    Downloading: 100%         
Use composer self-update --rollback to return to version d6d0435c5437111e42a123b06e4071e26ba7cb6e

composer install --ignore-platform-reqs
Loading composer repositories with package information
Installing dependencies (including require-dev)


  [InvalidArgumentException]                    
  Package is not installed: ext-mongo-1.6.12.0  


install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...

Also changed replace with provide, but same result...

Any idea where to look to at least get this installed?

@holtkamp
Copy link
Author

Aah, nevermind, I now see

"ext-mongo": "1.6.12"
already contains the provide part.

Does this part of the documentations still apply?

If your project includes a library that requires ext-mongo you need to also specify a provide option in your composer.json: "provide": { "ext-mongo": "1.6.12" }

Due to a limitation in composer you need to specify this in the root package.

Deploying to Heroku
For others reaching this issue, I think installing Heroku will fail anyhow, as Heroku itself will try to install ext-mongo anyhow, this is the output when trying to deploy to Heroku:

ERROR: Failed to install system packages.        
remote:                
remote:        Your platform requirements (for runtimes and extensions) could        
remote:        not be resolved to an installable set of dependencies, or a        
remote:        repository was unreachable.        
remote:                
remote:        Full error information from installation attempt:        
remote:                
remote:        > Loading repositories with available runtimes and extensions        
remote:        >         
remote:        > Your requirements could not be resolved to an installable set of packages.        
remote:        >         
remote:        >   Problem 1        
remote:        >     - ext-mongo 1.6.12 requires php 5.5.* -> no matching package found.        
remote:        >     - ext-mongo 1.6.12 requires php 5.6.* -> no matching package found.        
remote:        >     - doctrine/mongodb 1.2.1 requires ext-mongo ^1.2.12 -> satisfiable by ext-mongo[1.6.12].        
remote:        >     - Installation request for doctrine/mongodb 1.2.1 -> satisfiable by doctrine/mongodb[1.2.1].        
remote:        >         

@alcaeus
Copy link
Owner
alcaeus commented Feb 16, 2016

Just a quick word about the provide directive in composer.json: that one is needed so you don't need to specify --ignore-platform-reqs during composer install. Not sure what exactly heroku needs to be satisfied all dependencies are present.

As for the error you are getting in that first example, I'll have to take a look at that.

@holtkamp
Copy link
Author

Thanks for the response. Well, turns out my CLI was at php 5.6.18 when switching to 7.0.3 installation succeeds with:

{
  "provide": {
    "ext-mongo": "1.6.12"
  },
  "require": {
    "alcaeus/mongo-php-adapter": "dev-master"
  }
}

But also without the provide part. What is the advised approach? Leave it at the mongo-php-adapter level?

@alcaeus
Copy link
Owner
alcaeus commented Feb 16, 2016

The provide part is important when you add another package to the require. Go ahead and try adding the following packages to the require part:

"doctrine/mongodb-odm": "dev-master",
"doctrine/mongodb": "dev-master"

You'll find that you won't be able to install it with that provide directive but composer will complain about the missing ext-mongo dependency if you remove it. Of course, using --ignore-platform-reqs overrides this all so don't try it with that switch.

@holtkamp
Copy link
Author

Mm, ok, will experiment a bit, maybe heroku/heroku-buildpack-php#146 is not even an issue then...

@dzuelke
Copy link
Contributor
dzuelke commented Feb 16, 2016

@alcaeus should the directive not be replace instead of provide though?

@dzuelke
Copy link
Contributor
dzuelke commented Feb 16, 2016

Nevermind, just found #30 and #31. @alcaeus can you summarize your conversation with @Seldaek and explain what the Composer limitations are that cause this? Is it because platform packages get special treatment internally?

@alcaeus
Copy link
Owner
alcaeus commented Feb 17, 2016

Summary is: root package needs to specify replace but based on my observations provide works while replace doesn't. The problem is due to all packages starting with "ext-" getting a special treatment and only being checked with extension_loaded() and extension_version(). I'll be taking a look at that once I've gotten Beta-1 out the door which should be in a day or two.

In an ideal world, mongo-php-adapter would specify a replace for ext-mongo and all projects wanting to use the adapter would just specify a require to mongo-php-adapter - no other stuff required.

@holtkamp
Copy link
Author

Thanks for the detailed responses. The "ideal world" scenario sounds like a great place ;) Will run some additional tests to verify heroku/heroku-buildpack-php#146 is an issue or not..

@dzuelke
Copy link
Contributor
dzuelke commented Feb 22, 2016

So I had a conversation with @Seldaek yesterday and the tl;dr is that replace and provide should work pretty much the same way in this regard, and that both should be able to "override" PHP versions and extensions just like regular packages.

@alcaeus
Copy link
Owner
alcaeus commented Feb 22, 2016

That sounds good - the question is, should it be possible to define this override somewhere other than the root package?

@dzuelke
Copy link
Contributor
dzuelke commented Feb 22, 2016

I believe the answer is yes. I have to create a few reproduce cases and then open a ticket showing which permutations work and which are broken.

@alcaeus
Copy link
Owner
alcaeus commented Feb 22, 2016

@dzuelke Thanks for all the effort you're putting into this - I'll update the documentation to use replace instead of provide later.

@dzuelke
Copy link
Contributor
dzuelke commented Feb 22, 2016

What about this combination: mongo-php-adapter says "replace" for ext-mongo, root project composer.json says "require" for ext-mongo? Maybe that's the "correct" way, @alcaeus and @Seldaek and @naderman? See composer/composer#2690

@jmikola
Copy link
Contributor
jmikola commented Feb 22, 2016

If anything, this library would replace ext-mongo (i.e. the legacy driver). It depends on ext-mongodb, so I don't think you'd want to replace that.

@dzuelke
Copy link
Contributor
dzuelke commented Feb 22, 2016

Well yes of course @jmikola. Typo. Fixed.

@dzuelke
Copy link
Contributor
dzuelke commented Feb 23, 2016

Okay I can confirm that works, @alcaeus and @holtkamp (using the "composer-replace" branch since that still has it):

{
    "require": {
        "php": "^7.0",
        "alcaeus/mongo-php-adapter": "dev-composer-replace",
        "doctrine/mongodb": "dev-master"
    }
}

All is fine because doctrine/mongodb requires ext-mongo.

If no dependency requires that package, then you need to do it in the composer.json root:

{
    "require": {
        "php": "^7.0",
        "ext-mongo": "*",
        "alcaeus/mongo-php-adapter": "dev-composer-replace"
    }
}

This appears to be the preferred approach according to composer/composer#2690, and it works under all circumstances - both with ext-foo, as well as with "non-platform" packages (such as on Heroku, where "ext-foo" gets transformed to "heroku-sys/ext-foo").

dzuelke added a commit to dzuelke/mongo-php-adapter that referenced this issue Feb 23, 2016
To use this package, either composer.json or any dependency needs to require "ext-mongo", see composer/composer#2690 and alcaeus#67 and heroku/heroku-buildpack-php#146
dzuelke added a commit to dzuelke/mongo-php-adapter that referenced this issue Feb 23, 2016
To use this package, either composer.json or any dependency needs to require "ext-mongo", see composer/composer#2690 and alcaeus#67 and heroku/heroku-buildpack-php#146
@dzuelke
Copy link
Contributor
dzuelke commented Feb 23, 2016

PR here: #70

@alcaeus
Copy link
Owner
alcaeus commented Feb 23, 2016

PR has been merged. @holtkamp Can you close this issue if it's confirmed fixed with the latest dev-master or follow up with any errors you encounter? Thanks!

@holtkamp
Copy link
Author

mm, after removing my vendor dir, composer.lock and clearing composer caches, running composer install --ignore-platform-reqs with this composer.json:

{
  "require": {
    "php": "^7.0",
    "alcaeus/mongo-php-adapter": "dev-master",
    "doctrine/mongodb": "dev-master"
  }
}

succeeds. However when pushing to Heroku, the buildpack still complains:

git push heroku master         
Counting objects: 16, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (16/16), done.
Writing objects: 100% (16/16), 4.22 KiB | 0 bytes/s, done.
Total 16 (delta 10), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Using set buildpack heroku/php
remote: -----> PHP app detected
remote: -----> Bootstrapping...
remote: -----> Installing system packages...
remote: 
remote:  !     ERROR: Failed to install system packages.
remote:        
remote:        Your platform requirements (for runtimes and extensions) could
remote:        not be resolved to an installable set of dependencies, or a
remote:        repository was unreachable.
remote:        
remote:        Full error information from installation attempt:
remote:        
remote:        > Loading repositories with available runtimes and extensions
remote:        > 
remote:        > Your requirements could not be resolved to an installable set of packages.
remote:        > 
remote:        >   Problem 1
remote:        >     - ext-mongo 1.6.12 requires php 5.5.* -> no matching package found.
remote:        >     - ext-mongo 1.6.12 requires php 5.6.* -> no matching package found.
remote:        >     - doctrine/mongodb dev-master requires ext-mongo ^1.5 -> satisfiable by ext-mongo[1.6.12].
remote:        >     - Installation request for doctrine/mongodb dev-master -> satisfiable by doctrine/mongodb[dev-master].
remote:        > 
remote:        
remote:        Please verify that all requirements for runtime versions in
remote:        'composer.lock' are compatible with the list below, and ensure
remote:        all required extensions are available for the desired runtimes.
remote:        
remote:        For reference, the following runtimes are currently available:
remote:        
remote:        PHP:  7.0.3, 7.0.2, 7.0.1, 7.0.0, 5.6.18, 5.6.17, 5.6.16, 
remote:        5.5.32, 5.5.31, 5.5.30
remote:        HHVM: 3.5.1

When doing the same attempt for the other described scenario, with a composer.json like:

{
  "require": {
    "php": "^7.0",
    "alcaeus/mongo-php-adapter": "dev-master",
    "ext-mongo": "*"
  }
}

This results in:

git push heroku master                 
Counting objects: 20, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (20/20), done.
Writing objects: 100% (20/20), 4.59 KiB | 0 bytes/s, done.
Total 20 (delta 13), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Using set buildpack heroku/php
remote: -----> PHP app detected
remote: -----> Bootstrapping...
remote: -----> Installing system packages...
remote: 
remote:  !     ERROR: Failed to install system packages.
remote:        
remote:        Your platform requirements (for runtimes and extensions) could
remote:        not be resolved to an installable set of dependencies, or a
remote:        repository was unreachable.
remote:        
remote:        Full error information from installation attempt:
remote:        
remote:        > Loading repositories with available runtimes and extensions
remote:        > 
remote:        > Your requirements could not be resolved to an installable set of packages.
remote:        > 
remote:        >   Problem 1
remote:        >     - ext-mongo 1.6.12 requires php 5.5.* -> no matching package found.
remote:        >     - ext-mongo 1.6.12 requires php 5.6.* -> no matching package found.
remote:        >     - Installation request for ext-mongo * -> satisfiable by ext-mongo[1.6.12].
remote:        > 
remote:        
remote:        Please verify that all requirements for runtime versions in
remote:        'composer.lock' are compatible with the list below, and ensure
remote:        all required extensions are available for the desired runtimes.
remote:        
remote:        For reference, the following runtimes are currently available:
remote:        
remote:        PHP:  7.0.3, 7.0.2, 7.0.1, 7.0.0, 5.6.18, 5.6.17, 5.6.16, 
remote:        5.5.32, 5.5.31, 5.5.30
remote:        HHVM: 3.5.1
remote:        

So, I am not sure whether this issue can be closed just yet, did I test correctly?

@alcaeus
Copy link
Owner
alcaeus commented Feb 23, 2016

@holtkamp can you try composer install without --ignore-platform-reqs? The whole point of this provide vs. replace exercise is to get it working without using that nuclear option.

@dzuelke
Copy link
Contributor
dzuelke commented Feb 23, 2016

Yes @holtkamp the change is not merged yet for the buildpack. Please test according to the instructions at heroku/heroku-buildpack-php#146 (comment)

@holtkamp
Copy link
Author

Mm, ok, sorry for my ignorance ;).

In both cases this results in problems when on PHP 7.0.3 CLI:

composer install
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for doctrine/mongodb dev-master -> satisfiable by doctrine/mongodb[dev-master].
    - doctrine/mongodb dev-master requires ext-mongo ^1.5 -> the requested PHP extension mongo is missing from your system.

And without doctrine/mongodb

composer install
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested PHP extension ext-mongo * is missing from your system. Install or enable PHP's mongo extension.

@dzuelke
Copy link
Contributor
dzuelke commented Feb 23, 2016

That's weird; if that happens on your box then it would have to happen on push to Heroku as well!?

@alcaeus
Copy link
Owner
alcaeus commented Mar 10, 2016

Closing this - the composer issue is being tracked in composer/composer#5030 while the actual install issue is tracked in #30.

@alcaeus alcaeus closed this as completed Mar 10, 2016
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

4 participants
0