Open xuanxuan1231 opened 1 year ago
There are many requests like this @f3l1x . There seems to be a need for case specific runtimes. I have two suggestions for this (I have read the other problems with the GD Extention, this is just an example):
we consider if it is possible to add the extensions in a plugin system. For this I would have imagined that build a NPM module for each extension and then references not only the amazon-linux-php package via package.json but also the desired extension. This could look like this:
"dependencies": {
"@libphp/amazon-linux-2-v81": "latest",
"@libphp/gd-v81": "latest"
},
To consider is that it is then necessary to generate the php.ini based on the packages that you have installed.
I would offer to write a pull request with a guide, how to create a runtime with the special extention. I think that this repo should be a general base and not cover all possible cases.
Hi @SchramlTim.
Ad 1) This could be a great way how to install extra packages. However, I am not sure if it would be still possible, because we need to fit to 50Mb lambda size.
Ad 2) We can have a manual for that. But creating a new runtime could be challenge for someone.
Ad 3) I heard that Vercel will support lambda layers someday. It could solve all troubles with these extensions. Just like brefphp do it.
Ad 4) I can imagine way there is a full-bloated-libphp package with all possible extensions and you can enable/disable them via ENV. Something like VERCEL_PHP_EXTENSIONS=json,pdo,gd
or something like that. Going this way requires to track all extensions and their dependencies via ldd <extension.name.so>
and add/remove files from resulting lambda compilation. It sounds as hardcore, but it's not that bad.
What do you think?
Thanks for feedback! 1) I will sit down in the near future and sketch out a solution. Then I have also a better impression which things are drivers for the increased MB size.
2) Alright will do pull request with a basis for discussion
3) Unfortunately, I am too little in the Lambda game. I'll read in :)
4) Doesn't that also bump up against the lambda size limit? Otherwise I find the idea also very chic! The developer experience would thus lose complexity and push PHP for Vercel
Question
How to install other extension in it? Like
gd