Install grpc PHP extension on a project

Hello everyone,

Is someone managed to install the grpc extension on PHP project ?

I tried to follow the instructions for custom extensions in the documentation : https://docs.platform.sh/languages/php/extensions.html#custom-php-extensions

The extension is found but an other error appeared :

W: PHP Warning:  PHP Startup: Unable to load dynamic library '/app/grpc.so' (tried: /app/grpc.so (/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /app/grpc.so)), /usr/lib/php/20210902-zts//app/grpc.so.so (/usr/lib/php/20210902-zts//app/grpc.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

The solution is to use apt-get install, but it is not possible during the build processus.
Did someone managed to do this ?

Thanks by advance

I haven’t tried it myself yet, but another tool we have to do this is a set of snippets that can be adapted for different custom extensions. https://github.com/platformsh/snippets/tree/main/src

You’ll see examples there for Relay, PhpRedis, and Swoole.

https://community.platform.sh/t/how-to-install-grpc-for-php-in-platform-sh/1121/3?u=matthias-van-woensel