Skip to content

[WIP] Extension installer #2898

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
wants to merge 3 commits into from

Conversation

naderman
Copy link
Member

Supports PHP & HHVM.

Todo:

  • Need to come up with a solution for ext-* packages actually being installable now, so extensions can be compiled automatically to satisfy dependencies on extensions.
  • Documentation
  • Use a different downloader to download binary builds from github releases for windows (or pecl for PHP)
  • Output information on configuring the server to include extension.so

Replaces the earlier PR #498

@naderman naderman mentioned this pull request Apr 10, 2014
@Seldaek
Copy link
Member

Seldaek commented Apr 11, 2014

Todo: add a pecl.php.net composer repo and to make all these packages available and be able to download auto-built dlls on windows :)

@Seldaek
Copy link
Member

Seldaek commented Apr 11, 2014

Ah I missed the third point, but my point still stands, I think we need a way to get pecl stuff as a composer repository, and then maybe also support extension-typed packages on packagist? Could include a binary download url or something.

@naderman
Copy link
Member Author

Yes my idea was to have a way to specify alternative download urls based on architecture somehow.

@mnapoli
Copy link

mnapoli commented Apr 11, 2014

This will install the extension globally on the machine right?

@mcuadros
Copy link

About HNI extensions:

The HHVM HNI extension has the very similar installation process of the PHP extension, so this not should a problem.

hphpize
cmake .
make
make install

As I see, is very complex install extension from composer due to:

1a) From source: C/C++ library dependencies, for example Mongofill extension for HHVM requires libbson installed on the system.
1b) From binary, will require a horde of workers and config for compile every extension for every arch, os and PHP/HHVM version. (The sweet dream of a puppet guy)
2) The extension are installed globally, not locally like a common PHP package.
3) In the most of the cases will require root access to be installed
4) Some extensions for example pthreads requires a PHP version compiled with a specific option

Looks a great idea but with a bunch of problems in the back.

@naderman
Copy link
Member Author

@dzuelke didn't you want to write down what we discussed on this issue? ;-)

@dzuelke
Copy link
Contributor

dzuelke commented May 16, 2014

Will do, @naderman, thanks for the reminder :)

@pierrejoye
Copy link

For the record here:

see https://github.com/pierrejoye/pickle

@dzuelke
Copy link
Contributor

dzuelke commented Jun 17, 2014

Summary of my discussion with @naderman a few weeks ago:

There should be a composer install --extensions or similar command; it uses whatever plugin is installed (by default, that could be Pickle) to install missing extensions.

If an extension isn't available during a regular composer install, it'll error (probably with a slightly nicer message than currently) and advise users that they can try composer install --extensions and then try again.

Debian etc could ship a php5-composer package that has a different extension installer plugin enabled by default which tries an apt-get install php5-foobarz.

This is the only sane way, as one can only enable extensions globally in PHP by copying a small .ini to whatever conf.d folder that was (hopefully!) defined at ./configure time. The alternative is to use a fully replaced php.ini. The folder where PHP scans for additional files can't be re-defined at runtime.

So an approach where Composer on regular install writes out extra php.ini files clearly won't work, because a composer install works on an individual project, but it would have to modify this global state, and that state wouldn't change either when jumping around between different projects.

It also greatly simplifies the amount of work to be done ;) Much less complicated approach overall; installer plugin developers can figure out the gritty details for their respective platform(s) themselves.

@pierrejoye
Copy link

Just a status about pickle:

We are close to the 1st release, it supports:

  • 100% compatible json file
  • binary install on windows
  • pickle install apcu will fetch from pecl.php.net when available
  • pickle install supports git, http(s), etc.
  • packaging of release packages
  • fully compatible with current package PECL format (install or conversion, from package or repository)

About the roadmap, I will update the README and the wiki later this week but the main next points are:

  • automatic installation of deps extensions
  • plugins to support distributions packages (apt, rpm, etc.), to avoid to have to many tools for the same goal

Feedback, PRs, etc welcome :)

@kmiller68
Copy link

I am interested in helping out with getting an extension installer working. Are there any thoughts on how the extension installer plugin interface would look? I see a couple of design decisions:

  1. How to specify which plugin to use, such as pickle or an apt-get based installer (if the user does not want the default). I was thinking something along the lines of composer install --extensions apt-get or composer install --extensions pickle

  2. When people build the extension from source, how should they specify the C/C++ library dependencies. Based on the current system there is not an obvious way to do this. Additionally, if the dependency is installed via apt-get, rpm, etc the creator may have differing dependencies based on the distro/release.

Any thoughts?

@pierrejoye
Copy link

hi,

On Wed, Jul 23, 2014 at 8:20 PM, Keith Miller notifications@github.com
wrote:

I am interested in helping out with getting an extension installer
working. Are there any thoughts on how the extension installer plugin
interface would look? I see a couple of design decisions:

  1. How to specify which plugin to use, such as pickle or an apt-get based
    installer (if the user does not want the default). I was thinking something
    along the lines of composer install --extensions apt-get or composer
    install --extensions pickle

Please not that distros package support will be added in pickle (too?). As
we support binaries on windows, it just makes sense to have them as well.

  1. When people build the extension from source, how should they specify
    the C/C++ library dependencies. Based on the current system there is not an
    obvious way to do this. Additionally, if the dependency is installed via
    apt-get, rpm, etc the creator may have differing dependencies based on the
    distro/release.

Any thoughts?

We can do what we do on windows as well. Check the package dependencies and
fetch them. On *nix, either using packages or fetching from sources. We do
not yet implement that nor think about how to do it but raise an error on
configure, given that the config.m4 has the validations in place (99.99% of
them have it).


Reply to this email directly or view it on GitHub
#2898 (comment).

Pierre

@pierrejoye | http://www.libgd.org

@ovr
Copy link

ovr commented Mar 1, 2015

Any news?

@pierrejoye
Copy link

Pickle is almost feature complete now.

Composer part is being worked on.
On Mar 1, 2015 5:51 PM, "Дмитрий Пацура" notifications@github.com wrote:

Any news?


Reply to this email directly or view it on GitHub
#2898 (comment).

@brunoric
Copy link

+1 from Pickle being integrated on Composer. <3

@Seldaek Seldaek added this to the Nice To Have milestone Apr 12, 2016
@jean-pasqualini
Copy link

you planned to finish?

@DavertMik
Copy link

Any update on this from Composer or Pickle team?

@jippi
Copy link

jippi commented Oct 28, 2016

bump? :)

@dzuelke
Copy link
Contributor

dzuelke commented Oct 29, 2016

Still heavily unsure how useful this would really be... the issue remains that people run many different projects, and extensions would have to be installed for these, potentially even in different versions.

Two years ago I wrote:

The folder where PHP scans for additional files can't be re-defined at runtime.

That's actually not true; PHP_INI_SCAN_DIR can be used for that, and it can even include an empty segment to represent the ./configure time path. Still, the whole thing is a massive bag of hurt.

@cyrrill
Copy link

cyrrill commented Jul 31, 2017

Any updates on this PR? It's been open for 3 years now...

@sepehr
Copy link

sepehr commented Jul 31, 2017

Would be great to finally see this live.

@chris-kruining
Copy link

chris-kruining commented Nov 6, 2017

Any news? I would love to rewrite my lib with php-cpp to ship as an extension to improve performance :D But I refuse to ship the lib without composer support, just to stay modern and easy-to-use ;)

@atrauzzi
Copy link

Would love to see this completed!

Specifically in my case for: https://github.com/arnaud-lb/php-rdkafka

@filips123
Copy link

Is there any update? This PR is over 5 years old.

@yozman
Copy link

yozman commented Jul 16, 2020

any update?

@nick-zh
Copy link

nick-zh commented Nov 26, 2020

Are there any plans to progress with this or a way we can help out?
I would love to see pickle integrated, i think it would be a huge advantage to have "it" all in one place ❤️
PS: Thx for all the work guys 💪

@pierrejoye
Copy link

pierrejoye commented Nov 28, 2020 via email

@dzuelke
Copy link
Contributor

dzuelke commented Nov 28, 2020

For this to be useful at all, we still need https://github.com/phpenv/phpenv to be a thing everybody uses first, because otherwise, there will be endless conflicts from PHP's global INI and extension handling.

Otherwise, your composer install globally installs, say, ext-redis:4.0.1 (while at the same time installing all user-land dependencies only locally for the project), and your other project that needs v3 of that same extension will suddenly stop working.

@naderman
Copy link
Member Author

This PR was really just a random proof of concept that would never have worked in this way, and I left it open as a reference for the future. But to make it clear that there is no work going on in this particular direction I will close this now, There are other tickets open where discussion can continue like #3897 and other issues/prs may be opened in the future.

The tool to install extensions is pickle.

I'll point again to #2898 (comment) which describes why the best we can really hope for is for composer to help generate a list of extensions to install and potentially have a separate command which invokes pickle with that list.

The main problem that prevents deep integration is the fundamental difference between Composer's concept of dependencies local to a project inside a directory, and PHP's extensions which are typically installed system wide and not easily installable/loadable per project.

@naderman naderman closed this Nov 28, 2020
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

Successfully merging this pull request may close these issues.