php icon indicating copy to clipboard operation
php copied to clipboard

Custom PHP runtime

Open WilliamBlais opened this issue 5 years ago • 3 comments

Question

Hi, I would like to build a custom PHP library using https://github.com/juicyfx/libphp/tree/master/libs/amazon-linux-2-v80. However, Vercel-php assumes we're using @libphp/amazon-linux-2-v80. Would it be possible to make that a setting? Would it be possible to remove @libphp/amazon-linux-2-v80 from package.json and download it at build time instead?

Maybe I could create a script that lets you choose which PHP extension you want, build it and publish it to NPM. Then the user would be able to use his own custom library.

Thanks!

WilliamBlais avatar Jan 26 '21 07:01 WilliamBlais

Hi, thanks for question. I think I can install PHP during build time. But it requires little research. I hope it wouldn't be slower.

f3l1x avatar Jan 26 '21 08:01 f3l1x

@f3l1x thanks for the quick answer! Do you think it would be a good solution to modify getPhpFiles() in utils.ts to to download the file directly from npm and unzip it? Sounds possible?

Something like this; curl https://registry.npmjs.org/PACKAGE-NAME/
| jq '.versions[."dist-tags".latest].dist.tarball'

WilliamBlais avatar Jan 26 '21 08:01 WilliamBlais

I was using on-the-fly installation in early versions of vercel-php. It was harder to maintain it. What is your motivation to install custom PHP library?

f3l1x avatar Mar 26 '21 17:03 f3l1x