---
title: "PHP syntax errors or missing extensions when running BLT or Composer"
date: "2022-02-24T14:09:59+00:00"
summary:
image:
type: "article"
url: "/acquia-cloud-platform/help/94166-php-syntax-errors-or-missing-extensions-when-running-blt-or-composer"
id: "dd290a70-5b26-4673-a456-352229d1a9ef"
---

Table of contents will be added

Issue 
------

This manifests as errors that occur only in certain environments, often syntax errors or errors about missing extensions:

    PHP Parse error:  syntax error, unexpected ':', expecting ';' or '{' in /var/www/<project>/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php on line 50
    
    Parse error: syntax error, unexpected ':', expecting ';' or '{' in /var/www/<project>/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php on line 50
    Drush command terminated abnormally due to an unrecoverable error.                                                                             [error]
    Error: syntax error, unexpected ':', expecting ';' or '{' in
    /var/www/<project>/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php, line 50
    [Acquia\Blt\Robo\Tasks\DrushTask]  Exit code 255  Time 10.708s

Resolution
----------

Ensure that all environments are running the same version of PHP. This can be accomplished by changing PHP versions on the systems, and by "locking" the PHP version in your composer file and re-running composer update.

Example of how to lock PHP version to PHP 7.2 in composer.json:

    "require": {
      "php": "7.2"
    },

Cause
-----

This error occurs when Composer packages were installed on a machine running a newer PHP version than the environment exhibiting the error, leading to syntax errors or errors due to missing extensions. This error can affect VMs, continuous integration environments, and cloud environments.