php icon indicating copy to clipboard operation
php copied to clipboard

How can I install GD?

Open konnorov opened this issue 5 years ago • 9 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(

konnorov avatar May 24 '20 19:05 konnorov

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.

f3l1x avatar May 25 '20 11:05 f3l1x

Sad :(

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

konnorov avatar May 26 '20 14:05 konnorov

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 avatar May 26 '20 14:05 f3l1x

@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?

WilliamBlais avatar Aug 19 '20 04:08 WilliamBlais

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 avatar Aug 19 '20 20:08 f3l1x

@f3l1x @WilliamBlais

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

Jobians avatar Sep 09 '22 19:09 Jobians

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.

sonaxa avatar Oct 04 '22 22:10 sonaxa

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.

f3l1x avatar Oct 06 '22 07:10 f3l1x