pecl install gprc php extension on AWS Codebuild

Viewed 695

This is a cross-post which I posed earlier on the AWS forums.

I've spent the week on this issue and I am finally admitting I am stuck.

I am trying to build my PHP Laravel application on Codebuild. I followed this guide to set up a build environment locally: https://aws.amazon.com/blogs/devops/announcing-local-build-support-for-aws-codebuild/

During my composer install, I get an error telling me gRPC is not installed:

google/cloud-firestore v1.15.0 requires ext-grpc * -> the requested PHP extension grpc is missing from your system.

I was ultimately able to get pecl install with yum, by following these steps, pre-install, in my buildspec.yml:

- yum update -y
- php -v
- yum install -y php-pear php-devel
- /usr/bin/yes 'no' | pecl install -f grpc
- php --ini
- echo 'extension="/usr/lib64/php/modules/grpc.so"' > /root/.phpenv/versions/7.4.7/etc/php.ini
- php --ini

php -v outputs:

PHP 7.4.7 (cli) (built: Sep 10 2020 23:53:02) ( NTS )

However, during my yum install of php-devel, I notice it is pointing to an older version of (5.4):

================================================================================ 
Package   | Arch   | Version              | Repository | Size
================================================================================ 
php-devel | x86_64 | 5.4.16-46.amzn2.0.2  | amzn2-core | 602 k 
php-pear  | noarch | 1:1.10.7-3.amzn2.0.1 | amzn2-core | 354 k

During my pecl install, I get warnings that I am installing against php 5.4, which I suppress with the -f option:

warning: pecl/grpc requires PHP (version >= 5.5.0), installed version is 5.4.16

However, composer still won't install my dependency, I get the error:

PHP Warning: PHP Startup: grpc: Unable to initialize module Module compiled with module API=20100525 PHP compiled with module API=20190902 These options need to match in Unknown on line 0 Loading composer repositories with package information Installing dependencies from lock file Your requirements could not be resolved to an installable set of packages. Problem 1

  • Installation request for google/cloud-firestore v1.15.0 -> satisfiable by google/cloud-firestorehttp://v1.15.0.
  • google/cloud-firestore v1.15.0 requires ext-grpc * -> the requested PHP extension grpc is missing from your system.

Any thoughts on how to install php-devel for the correct version of PHP so I can install the correct version of grpc?

Thanks, Ehren

0 Answers
Related