vercel-community / php

🐘 PHP Runtime for ▲ Vercel Serverless Functions (support 7.4-8.3)

Home Page:https://php.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I install GD?

konnorov opened this issue · comments

How can I remove the error:

Fatal error: Uncaught Error: Call to undefined function imagecreatefrompng() in /var/task/user/api/image.php:8 Stack trace: #0 {main} thrown in /var/task/user/api/image.php on line 8

help plz(

Hey @konnorov. GD extension is not bundled in now-php. It requires so many shared libs and Vercel's limit is about 50mb per lambda.

Sad :(

Are there any other ways to add text to photos supported by ZEIT?

I see few options here.

  • You can elaborate how to bundle GD
  • You can elaborate how to minify PHP libs
  • You can use nodejs for image transformations. Rest of your app could be in PHP.

@f3l1x If I add gd to php.ini, will it work? Do you have any examples on how to add an extension to vercel/php?

Hi @WilliamBlais. Problem is not PHP ini, but GD extension it self. It looks like it requires so much filespace (filesize) and many shared libraries installed on platform. We are limited by 50 MB per 1 lambda. So, GD extension is not supported at this moment.

Take a look at FAQ (https://github.com/juicyfx/vercel-php#%EF%B8%8F-faq), there is example how to edit php.ini.

@f3l1x @WilliamBlais

Please I encounter this issue, have you find any solution for it?

Hey @f3l1x
Found that the gd extension it is present in an older version Here
Would it be possible to include it ? or a way to make it work ? I keep getting the error below when using the older vercel-php version which uses that extension during build

Error: The Runtime @vercel/vc-build is using nodejs12.x, which was discontinued by an upstream provider. In turn, we have to ask you to upgrade your Runtime to a more recent version or consult the author for more details.

Hi @sonaxa and @Jobians, there is a problem with size of the lambda.

Problem is not PHP ini, but GD extension it self. It looks like it requires so much filespace (filesize) and many shared libraries installed on platform. We are limited by 50 MB per 1 lambda. So, GD extension is not supported at this moment.