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

Rewrite to be based on php-build #72

Open
smorimoto opened this issue Jan 23, 2021 · 17 comments
Open

Rewrite to be based on php-build #72

smorimoto opened this issue Jan 23, 2021 · 17 comments
Labels
enhancement New feature or request

Comments

@smorimoto
Copy link
Member

There is no benefit on our side to managing this too complex shell nightmare, and it should be managed centrally if possible.

@smorimoto smorimoto added the enhancement New feature or request label Jan 23, 2021
@moljac024
Copy link

Better yet, why not install php precompiled? That would make the plugin so much easier to use (no need to install build dependencies and wait for php to compile etc.)

Side rant: I can't believe it's 2021 and we still haven't shaken this "compile everything" idea in general oss. Right now, right this very second, there's millions of compiles of the same thing happening all over the world.

@smorimoto
Copy link
Member Author

I don't mind. PR is always welcome.

@moljac024
Copy link

Perhaps supporting both initially is the way to go. How about we transition to php-build but we cache the builds of individual versions somewhere online? So when someone wants to install a specific version, we:

  • Check if we have the build for this architecture cached already and if we do, just pull that and be done
  • If we don't have it cached, do the build via php-build and upload the artifacts to the build cache for the next person to benefit

Then the obvious question is, where can we host the builds for free?

What do you think?

@smorimoto
Copy link
Member Author

The biggest issue is how to distribute the cache as you mentioned. Also, I'm not really familiar with PHP, but are they really relocatable? At this point, I don't have a clear ETA for php-build migration, so if you want to work on it, I recommend that you start by migrating to it first.

@moljac024
Copy link

Sadly I'm not familiar with PHP either. My only contribution was the comment about avoiding compilation if possible but in retrospect it's not really useful.

@smorimoto
Copy link
Member Author

In fact, there is no incentive to host the cache at all, and implementing something to make sure the cache is safe is quite a hassle. And we need to minimize the dependencies that it requires, and I don't want to do that. I won't stop if someone does it in another plugin, but I absolutely don't want to distribute third-party caches to users through this plugin.

@iloveitaly
Copy link
Contributor

I looked into this a bit. IMHO this codebase is way better organized, and actually supports a greater set of options than php-build. I'd vote for not moving over to use php-build.

@smorimoto
Copy link
Member Author

The advantage of using php-build is that it can support more versions. Our current code only targets the latest version and does not support older versions. (There are some versions that can be built, but we can't say that they are officially supported.)

@iloveitaly
Copy link
Contributor

True, although there are some tradeoffs to consider. The downside is there are a lot of compilation options which are not supported in php-build (--with-gmp for instance). For me, this would be really problematic. Additionally, php-build doesn't seem to fix into the asdf super cleanly (the default assumption is you are using phpenv, although there could be an easy way around that.

We could expand the PHP version matrix in this github workflow to cover more PHP versions, although we still wouldn't have the larger test suite available to us and there would still be duplicated efforts.

@smorimoto
Copy link
Member Author

smorimoto commented Apr 26, 2021

The downside is there are a lot of compilation options which are not supported in php-build (--with-gmp for instance).

I don't think so: https://github.com/php-build/php-build/blob/master/man/php-build.1.ronn#environment

@b1rdex
Copy link

b1rdex commented Mar 22, 2022

Another option: https://github.com/shivammathur/homebrew-php + https://github.com/shivammathur/homebrew-extensions

@smorimoto
Copy link
Member Author

Somehow I had to come back to the PHP world. I've read some PR, but I'm sure what we need now is to rewrite the php-build based plugin. Does anyone want to tackle it?

@tarik02
Copy link

tarik02 commented Sep 27, 2022

Better yet, why not install php precompiled? That would make the plugin so much easier to use (no need to install build dependencies and wait for php to compile etc.)

Side rant: I can't believe it's 2021 and we still haven't shaken this "compile everything" idea in general oss. Right now, right this very second, there's millions of compiles of the same thing happening all over the world.

If you want to provide precompiled PHP, you have to also provide precompiled versions of many libraries used by PHP, for example OpenSSL, icu and others since PHP depends on them and user's system can have variety of versions (especially major versions).

@smorimoto smorimoto pinned this issue Sep 28, 2022
@smorimoto
Copy link
Member Author

There are currently not enough main maintainers for this plugin, so it would be nice if someone could do it. Furthermore, if anyone would like to replace this with a php-build-based implementation, I'd be happy to help.

@tarik02
Copy link

tarik02 commented Sep 28, 2022

There are currently not enough main maintainers for this plugin, so it would be nice if someone could do it. Furthermore, if anyone would like to replace this with a php-build-based implementation, I'd be happy to help.

I did some investigation, I still have CI broken for example (https://github.com/Tarik02/asdf-php). However this works for my local machine (Arch) it does not work on latest ubuntu machines. As I discovered, the problem is that ubuntu includes libxml which itself uses libicu (which I built together with php) of different version.

So, now I see the only approach is to build most of dependencies before building PHP and use them, e.g. whole prefix with dependencies for it. I'm gonna do more investigation about this.

For arch, it builds (assuming you have the needed dependencies) most verions like 5.6.40, 7.0.33, 7.1.33, 7.4, 8.1.10 and they work as expected. But for ubuntu it's completely broken.

@99linesofcode
Copy link

Ok so, I just read this thread after mentioning you elsewhere @smorimoto. I think moving to php-build make sense as that is actively maintained and will drastically reduce the amount of maintenance required to keep this up to date.

As far as @moljac024's argument against building from source: I understand the frustration but the alternative requires quite a bit of work to streamline. Either way you go about it, it comes with it's own downsides. At least building from source keeps things relatively straight forward as most operating systems have or had access to the dependencies at some point in time.

@a21ns1g4ts
Copy link
Contributor

there are a lot of deprecated packages required by php <= 7. No easy way to work with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

7 participants