Install GRPC on Ubuntu to use Google Firebase with PHP

Oct 2, 2020, 3:02 PM

The GRPC library has to be built from scratch on your system. A good way to do this if you have different versions of PHP installed is to use the following commands

$ pecl -d php_suffix=5.6 install <package>
$ pecl uninstall -r <package>

$ pecl -d php_suffix=7.0 install <package>
$ pecl uninstall -r <package>

$ pecl -d php_suffix=7.1 install <package>
$ pecl uninstall -r <package>

$ pecl -d php_suffix=7.4 install <package>
$ pecl uninstall -r <package>

You will also need the phpize and php-dev modules installed

sudo apt install phpize

sudo apt install php-dev

Finally the compilation requires zlib.h

sudo apt-get install libz-dev

To enable the module you must add the following line to your php.ini

extension=grpc.so