How to install grpc for PHP in Platform.sh
Hello community and thank you for this forum.
I’m new to Platform.sh and using grpc to communicate with CloudFirestore on my Symfony app.
I’m not sure I fully understand how I should install grpc extension php on the environment.
I need to follow this : https://cloud.google.com/php/grpc
I need to install PECL with this command
sudo apt-get install autoconf zlib1g-dev php-dev php-pear
then install grpc through that.
I also need to enable extension=grpc.so.
Should I modify the platform.app.yaml file like this?
dependencies:
php:
grpc/grpc: "1.48.0"
compose/compose: "^2"
Load a bash .sh script for the install command ?
I saw in the documentation that I could load a new php.ini file or maybe use ‘variable’ in platform.app.yaml instead, but I’m not sure how to do it right…
Thank you very much for your help and your time
Comments
Hi there!
We have a section in our documentation covering Installing Custom PHP extensions. You won’t have access to
apt-geton our containers.Our team also maintains a few example snippets for installing specific extensions that you can take a look at (swoole, relay, and phpredis).
For future people getting to this article, I wrote a
pecltool that simplifies the building of custom extensions throughpecland also uses the PLATFORM_CACHE to speed up subsequent builds.Usage is as simple as
The
peclsource code can be found on github and can be placed inside your project folder. Feel free to change it as you see fit.Please sign in to leave a comment.