Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use php extensions in Google Cloud App Engine

I'm trying to run a symfony4 application in the Google Cloud App Engine following this instructions.

My app has a dependency which itself depends on php-gd. This extension seems to be unavailable since composer fails with the requested PHP extension gd is missing from your system..

How would I have to modify the tutorial to have the extension available?

Can this be solved with a php.ini file or do I need a custom environment?

Alternatively since I don't need the parts of my dependency which require php-gd, is there a way to get composer run with the --ignore-platform-reqs flag?

like image 236
Johannes Buchholz Avatar asked Sep 04 '18 12:09

Johannes Buchholz


3 Answers

Well this is based on Symfony

So on the root of your application create a file php.ini

In the file enter this line

extension=gd.so

So that your php.ini file will look like this.

sample

like image 120
Mwangi Thiga Avatar answered Nov 15 '22 13:11

Mwangi Thiga


Google Cloud App Engine only seems to load extensions required in the top level composer.json's require.

It does not seem to resolve dependencies recursevly.

Therefore a workaroud is to add all required extensions manually to the projects composer.json.

like image 34
Johannes Buchholz Avatar answered Nov 15 '22 11:11

Johannes Buchholz


Make sure to get installed this php-gd or apt-get install php5-gd

-your OS apt-get install php gd or apt-get install php5-gd, be aware of your php version.

The other approach here woulbe to add "ext-gd": "*" to your application's composer.json:

composer require "ext-gd:*" --ignore-platform-reqs It doesn't matter if gd is enabled in your local PHP install, the flexible environment is built using your composer.json and app.yaml files, so you need to add it there.

like image 3
Jose Antonio Avatar answered Nov 15 '22 12:11

Jose Antonio