Skip to content
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

composer install fails with *The Process class relies on proc_open, which is not available on your PHP installation.* #9253

Closed
lmeyer1 opened this issue Oct 1, 2020 · 9 comments

Comments

@lmeyer1
Copy link

lmeyer1 commented Oct 1, 2020

My composer.json:

{
    "name": "maison-bible/prestashop",
    "description": "Prestashop Livre et plus",
    "repositories": [
        {
            "type": "vcs",
            "url": "git@bitbucket.org:maisonbible/stripe-official.git"
        }
    ],
    "require": {
        "composer/installers": "^1.0.21",
        "202-ecommerce/stripe-official": "dev-lmeyer"
    },
    "authors": [
        {
            "name": "Societe Biblique de Geneve",
            "email": "assistance@bible.ch"
        }
    ]
}

Output of composer diagnose:

Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
Checking platform settings: OK
Checking git settings:
                                                                                
  [Symfony\Component\Process\Exception\RuntimeException]                        
  The Process class relies on proc_open, which is not available on your PHP installation.
                                                                                

diagnose

When I run this command:

composer install

I get the following output:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 1 install, 0 updates, 0 removals
  - Installing 202-ecommerce/stripe-official (dev-lmeyer 5939a51):
                                                                                
  [Symfony\Component\Process\Exception\RuntimeException]                        
  The Process class relies on proc_open, which is not available on your PHP installation.

And I expected this to happen:

I expected to be able to run composer install without issue.

Is there a way to circumvent the problem of proc_open not being available ? If yes, what should I do ?

@stof
Copy link
Contributor

stof commented Oct 1, 2020

I don't think this is possible. Composer relies heavily on being able to run commands.

@lmeyer1
Copy link
Author

lmeyer1 commented Oct 1, 2020

I found the solution on SO https://stackoverflow.com/a/31667576/1951708

php -d "disable_functions=" /path/to/composer install

On our hosting it is possible to circumvent the disable_functions in php.

@Seldaek
Copy link
Member

Seldaek commented Oct 12, 2020

Alternatively running composer install --prefer-dist might make it work if you're lucky but yes generally speaking we do require external processes for a lot of things.

@Seldaek Seldaek closed this as completed Oct 12, 2020
@Mark-H
Copy link

Mark-H commented Aug 17, 2021

Understandably, enabling proc_open would be the preferred solution.

However I'm finding a composer install on shared hosting out of my control to work fine if it can't find an unzip command. It then falls back to using ZipArchive/Zip extension, which has its own drawbacks that the output warns about, but does not require proc_open to successfully install packages.

(Side note: In this case the only thing I'm doing is a composer install from a lockfile with a couple of options (prefer dist, optimise autoloader) so that doesn't seem to require any other external processes (or those are already skipped if proc_open isn't available). It's just extracting the archives that's affected in my use case.)

@Seldaek: do you think adding a && \function_exists('proc_open') check here has a chance of getting accepted into Composer so it falls back to ZipArchive (or just fails if it's not going to be able of unzipping)?

Alternatively, perhaps adding that check in the extractWithSystemZip method may be more appropriate as that's already supposed to fallback to ZipArchive, but doesn't because it fails to consider if proc_open is available. I'm not sure why that isn't already falling back to ZipArchive anyway when running the Process fails because of proc_open..

I could prepare a quick PR, but as I've not contributed to Composer before and probably lack a bunch of context, I would also be happy to pay someone on the team/a regular contributor for an hour of their time instead...

@Seldaek
Copy link
Member

Seldaek commented Aug 17, 2021

Yeah that makes sense, we want to support some basic install code-path without proc_open for sure, I can do the fix quickly.

@Mark-H
Copy link

Mark-H commented Aug 17, 2021

That would be amazing, thanks. Also for a very fast response!

How can I best pay you for your time? I see the Github Sponsors can take a one-time donation on the Composer org, does that work?

@Seldaek
Copy link
Member

Seldaek commented Aug 18, 2021

Sure sponsoring on the composer org is Sure sponsoring on the composer org is a good place, thanks!

60fe670 should fix it.

@Mark-H
Copy link

Mark-H commented Aug 19, 2021

@Seldaek Just tested the latest snapshot on 2 different environments without proc_open (one with unzip, one without) and it's working brilliantly. Thank you!

Will send a donation (from @modmore) in a bit. :)

@Mark-H
Copy link

Mark-H commented Sep 1, 2021

For some reason the sponsoring didn't go through the first time, so I've just added it again, which should get to you on September 28th.

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