buildpacks icon indicating copy to clipboard operation
buildpacks copied to clipboard

ext-protobuf version outdated in PHP runtime

Open iamacarpet opened this issue 2 months ago • 11 comments

Describe the bug The protobuf.so extension within the PHP runtime image(s) is outdated, specifically on PHP8.3.

google/gax has recently been updated to require a more recent version:

    "conflict": {
        "ext-protobuf": "<4.31.0"
    },

https://github.com/googleapis/gax-php/blob/main/composer.json#L27

@jama22 , any chance of getting this updated please?

Additional context How are you using GCP buildpacks?

  • [ ] pack and the gcr.io/buildpacks/builder
  • [ ] Cloud Functions
  • [x] Cloud Run
  • [x] Cloud Build
  • [x] App Engine Standard
  • [ ] App Engine Flex
  • [ ] Firebase App Hosting

Did this used to work?

Yes

This looks to have broken within the last month.

What language is your project primarily written in? PHP

Steps To Reproduce Easiest way to reproduce

  1. Start with a project that has a composer.json and composer.lock, including google/cloud (latest), on PHP 8.3.
  2. Using container image europe-west1-docker.pkg.dev/serverless-runtimes/google-22-full/runtimes/php83:latest, install composer.
  3. In that container image:
    • Ensure extension=protobuf.so and extension=grpc.so are in php.ini
    • Run composer install --no-dev --no-progress -o

Expected behavior

Composer to install the packages successfully.

Actual behavior

Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - ext-protobuf is present at version 3.24.4 and cannot be modified by Composer
    - google/gax is locked to version v1.38.0 and an update of this package was not requested.
    - google/gax v1.38.0 conflicts with ext-protobuf <4.31.0.

To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php.ini
    - /srv/php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-protobuf` to temporarily ignore these required extensions.

This obviously goes away if you run composer update with that version of ext-protobuf installed & enabled (inside the container image), however, you then become locked / stuck on an old version of google/gax.

iamacarpet avatar Oct 21 '25 10:10 iamacarpet

The protobuf extension is now updated to use latest version - 4.33.0 for php83

Hemant28codes avatar Nov 11 '25 04:11 Hemant28codes

@iamacarpet can you confirm if the issue has been resolved or not ?

Hemant28codes avatar Nov 11 '25 04:11 Hemant28codes

Hey @Hemant28codes,

Thanks so much for pushing the update to ext-protobuf (4.33.0) on the php83 runtime! We've confirmed it's live, and I really appreciate you tackling that for us.

Unfortunately, this has highlighted a "part two" of the problem, which is what I'm now facing: the builder image is still on the old version (ext-protobuf v3.24.4).

This has created a new dependency-hell loop for us:

  1. Now that the runtime has ext-protobuf v4, our old google/gax library (which was built for v3) immediately started throwing E_USER_DEPRECATED errors in production (like getLabel is deprecated...).
  2. This is fine (and technically our fault for running an old lib / our specific framework (FuelPHP) stupidly treating these non-fatal warnings as fatal). The correct fix, of course, is for us to run composer update to get the new google/gax that's compatible with ext-protobuf v4.
  3. ...and here's the new problem: When we try to deploy our updated composer.lock, the build step fails. The composer install (run by the buildpack) checks the builder's environment, sees the old ext-protobuf v3, and fails the dependency check.

So, to answer your question: the runtime update is complete, but the overall issue of the builder/runtime mismatch isn't resolved. We're now blocked from deploying the fix for the deprecation warnings.

Is it possible to get the builder image updated to match the new runtime? This would solve the problem entirely.

This is logged with Google Cloud Support as case # 64787103.

(This seems to be the same issue for opentelemetry.so, which is also present on the runtime but completely missing from the builder, causing similar warnings during the build step).

Thanks again for all your help on this!

Regards, @iamacarpet

iamacarpet avatar Nov 11 '25 12:11 iamacarpet

Hi @iamacarpet, we don't have these extensions versions defined in our builder, can you share some details around which exact error are you seeing, also do you have any specific section of buildpack where you see these extensions being downloaded?

Hemant28codes avatar Nov 11 '25 14:11 Hemant28codes

@Hemant28codes , sure thing - this is the log from Cloud Build - this is with an App Engine source deploy on php83:

Starting Step #2 - "build"
Step #2 - "build": Already have image (with digest): europe-west1-docker.pkg.dev/serverless-runtimes/google-22-full/builder/php:php_20251104_RC00
Step #2 - "build": ===> ANALYZING
Step #2 - "build": Restoring data for SBOM from previous image
Step #2 - "build": ===> DETECTING
Step #2 - "build": target distro name/version labels not found, reading /etc/os-release file
Step #2 - "build": 5 of 6 buildpacks participating
Step #2 - "build": google.php.runtime          0.0.2
Step #2 - "build": google.php.composer-install 0.0.1
Step #2 - "build": google.php.composer         0.9.1
Step #2 - "build": google.php.appengine        0.9.0
Step #2 - "build": google.utils.label-image    0.0.2
Step #2 - "build": ===> RESTORING
Step #2 - "build": Restoring metadata for "google.php.runtime:php" from cache
Step #2 - "build": Restoring metadata for "google.php.composer-install:composer" from cache
Step #2 - "build": Restoring metadata for "google.php.composer:composer" from cache
Step #2 - "build": Restoring metadata for "google.php.appengine:config" from app image
Step #2 - "build": Restoring data for "google.php.runtime:php" from cache
Step #2 - "build": Restoring data for "google.php.composer-install:composer" from cache
Step #2 - "build": Restoring data for "google.php.composer:composer" from cache
Step #2 - "build": ===> BUILDING
Step #2 - "build": target distro name/version labels not found, reading /etc/os-release file
Step #2 - "build": === PHP - Runtime ([email protected]) ===
Step #2 - "build": Using runtime version from GOOGLE_RUNTIME_VERSION: 8.3.25
Step #2 - "build": Using exact version 8.3.25 for PHP Runtime
Step #2 - "build": ***** CACHE HIT: "php"
Step #2 - "build": PHP Runtime v8.3.25 cache hit, skipping installation.
Step #2 - "build": === PHP - Composer Install ([email protected]) ===
Step #2 - "build": ***** CACHE HIT: "composer"
Step #2 - "build": composer binary cache hit, skipping installation.
Step #2 - "build": === PHP - Composer ([email protected]) ===
Step #2 - "build": ***** CACHE MISS: "composer"
Step #2 - "build": Installing application dependencies.
Step #2 - "build": --------------------------------------------------------------------------------
Step #2 - "build": Running "composer install --no-dev --no-progress --no-interaction --optimize-autoloader"
Step #2 - "build": 
Step #2 - "build": Warning: PHP Startup: Unable to load dynamic library 'opentelemetry.so' (tried: /layers/google.php.runtime/php/lib/php/extensions/no-debug-non-zts-20230831/opentelemetry.so (/layers/google.php.runtime/php/lib/php/extensions/no-debug-non-zts-20230831/opentelemetry.so: cannot open shared object file: No such file or directory), /layers/google.php.runtime/php/lib/php/extensions/no-debug-non-zts-20230831/opentelemetry.so.so (/layers/google.php.runtime/php/lib/php/extensions/no-debug-non-zts-20230831/opentelemetry.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Step #2 - "build": Installing dependencies from lock file
Step #2 - "build": Verifying lock file contents can be installed on current platform.
Step #2 - "build": Your lock file does not contain a compatible set of packages. Please run composer update.
Step #2 - "build": 
Step #2 - "build":   Problem 1
Step #2 - "build":     - ext-protobuf is present at version 3.24.4 and cannot be modified by Composer
Step #2 - "build":     - google/gax is locked to version v1.38.1 and an update of this package was not requested.
Step #2 - "build":     - google/gax v1.38.1 conflicts with ext-protobuf <4.31.0.
Step #2 - "build": 
Step #2 - "build": To enable extensions, verify that they are enabled in your .ini files:
Step #2 - "build":     - /workspace/php.ini
Step #2 - "build": You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Step #2 - "build": Alternatively, you can run Composer with `--ignore-platform-req=ext-protobuf` to temporarily ignore these required extensions.
Step #2 - "build": Done "composer install --no-dev --no-progress --no-interaction --o..." (285.023607ms)
Step #2 - "build": --------------------------------------------------------------------------------
Step #2 - "build": failed to build: composer install: (error ID: 8fe845e7):
Step #2 - "build": Warning: PHP Startup: Unable to load dynamic library 'opentelemetry.so' (tried: /layers/google.php.runtime/php/lib/php/extensions/no-debug-non-zts-20230831/opentelemetry.so (/layers/google.php.runtime/php/lib/php/extensions/no-debug-non-zts-20230831/opentelemetry.so: cannot open shared object file: No such file or directory), /layers/google.php.runtime/php/lib/php/extensions/no-debug-non-zts-20230831/opentelemetry.so.so (/layers/google.php.runtime/php/lib/php/extensions/no-debug-non-zts-20230831/opentelemetry.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Step #2 - "build": Installing dependencies from lock file
Step #2 - "build": Verifying lock file contents can be installed on current platform.
Step #2 - "build": Your lock file does not contain a compatible set of packages. Please run composer update.
Step #2 - "build": 
Step #2 - "build":   Problem 1
Step #2 - "build":     - ext-protobuf is present at version 3.24.4 and cannot be modified by Composer
Step #2 - "build":     - google/gax is locked to version v1.38.1 and an update of this package was not requested.
Step #2 - "build":     - google/gax v1.38.1 conflicts with ext-protobuf <4.31.0.
Step #2 - "build": 
Step #2 - "build": To enable extensions, verify that they are enabled in your .ini files:
Step #2 - "build":     - /workspace/php.ini
Step #2 - "build": You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Step #2 - "build": Alternatively, you can run Composer with `--ignore-platform-req=ext-protobuf` to temporarily ignore these required extensions.
Step #2 - "build": ERROR: failed to build: exit status 1
Finished Step #2 - "build"
ERROR
ERROR: build step 2 "europe-west1-docker.pkg.dev/serverless-runtimes/google-22-full/builder/php:php_20251104_RC00" failed: step exited with non-zero status: 51

We are temporarily working around this by putting the following in app.yaml:

build_env_variables:
  GOOGLE_COMPOSER_ARGS: "--ignore-platform-req=ext-protobuf"

iamacarpet avatar Nov 11 '25 14:11 iamacarpet

Okk i see the issue, we will have to update our tarball version as well in that case. I have started a fix for it. Just to confirm are you specifying the version of php(8.3.25) to be used as well?

Hemant28codes avatar Nov 11 '25 14:11 Hemant28codes

@Hemant28codes brilliant, thanks so much!

Just to confirm are you specifying the version of php(8.3.25) to be used as well?

No, in app.yaml:

runtime: php83

And in composer.json:

{
    "require": {
        "php": "^8.2"
    }
}

Can I please ask?:

  1. Last I spoke with someone on the runtimes team, the plan was to ensure the PECL extensions matched between the run & builder images more generally, i.e. all the same versions, and include the same modules (i.e. opentelemetry currently missing from builder). Is this still likely to happen?
  2. Is this protobuf update (across both run & builder images) being replicated on the other PHP runtime versions? i.e. PHP 8.4 & PHP 8.5 - we plan to upgrade to at-least PHP 8.4 in the New Year, and ideally PHP 8.5 once it's GA, so would like to ensure it's applied everywhere.

iamacarpet avatar Nov 11 '25 15:11 iamacarpet

UPDATE: Just noticed, we aren't specifying a specific PHP version, but App Engine is when it's creating the Cloud Build job to run the buildpack:

Image Image Image

iamacarpet avatar Nov 11 '25 15:11 iamacarpet

  1. Yes, so we do plan to ensure the version remains same across run and builder images.
  2. We can upgrade the versions for other runtimes as well, as i can see, other runtimes are already using version 4.31.0 for protobuf

Hemant28codes avatar Nov 11 '25 15:11 Hemant28codes

في الثلاثاء، ١١ نوفمبر ٢٠٢٥، ٥:١٧ م Hemant Goyal @.***> كتب:

Hemant28codes left a comment (GoogleCloudPlatform/buildpacks#564) https://github.com/GoogleCloudPlatform/buildpacks/issues/564#issuecomment-3517402129

  1. Yes, so we do plan to ensure the version remains same across run and builder images.
  2. We can upgrade the versions for other runtimes as well, as i can see, other runtimes are already using version 4.31.0 for protobuf

— Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/buildpacks/issues/564#issuecomment-3517402129, or unsubscribe https://github.com/notifications/unsubscribe-auth/BZRMBG4VLWHWT6FSIRVEZET34H4Z3AVCNFSM6AAAAACJYS67HWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKMJXGQYDEMJSHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mohomra33-stack avatar Nov 11 '25 15:11 mohomra33-stack

I found a solution.

Add to composer:

    "config": {
        "platform": {
            "ext-protobuf": "4"
        }
    },

sl0wik avatar Nov 21 '25 19:11 sl0wik