tomjn / composerpress

Retroactively creates a composer.json for a WordPress site
88 stars 6 forks source link

proc_open #6

Closed strarsis closed 7 years ago

strarsis commented 7 years ago
Fatal error: Uncaught Symfony\Component\Process\Exception\RuntimeException: The Process class relies on proc_open, which is not available on your PHP installation. [...]

Could the use of proc_open be avoided?

tomjn commented 7 years ago

I don't use it directly, it's used indirectly by the various packages. Without it I presume support for git would need to be dropped, so yes it's a requirement.

It's possible that it could be done in pure PHP by parsing the .git/config folder to figure out what the origin is. Figuring out which branch is the current branch is more difficult however.

If you implement this with unit tests as a library I'll happily use it, but it's far beyond the scope of what composerpress should do

So yes, it can, but it's not a trivial task, and I won't do it myself

strarsis commented 7 years ago

Would using a PHP library for native git support overkill, e.g. https://github.com/czproject/git-php ? Edit: It could be just pulled in with composer like the other dependencies.

tomjn commented 7 years ago

@strarsis that uses exec https://github.com/czproject/git-php/blob/master/src/GitRepository.php#L580 it's not native PHP at all. If it were pure PHP I'd be deeply suspicious of it, and i'd expect the library to be massive

tomjn commented 7 years ago

Also according to the PHP docs:

(PHP 4 >= 4.3.0, PHP 5, PHP 7) http://php.net/manual/en/function.proc-open.php

If your machine does not support proc_open then I very much doubt that it supports Composer fully, and is likely running an ancient version of PHP, or it's configured explicitly to prevent shell execution, so exec won't be available either.

If you really need to run Composerpress, either switch hosts, or pull a copy of the site on to your computer in a local dev environment such as flywheel or VVV, and run it there.