skip to Main Content

syntax error, unexpected ‘Parser’ (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)", "exception": "ParseError", vendor/lcobucci/jwt/src/Configuration.php", "line": 22

I have PHP 8.0 and composer v2.0 installed.

The project work locally using xampp perfectly but showing this error in Ubuntu 20.04, nginx config on Digtalocean

3

Answers


  1. I had the same exact err, causing a 500 internal server error.

    by adding "lcobucci/jwt": "^3.3.3" to my composer.json fixed the issue.

    It’s mostly dependencies issue, first I downgraded my laravel/passport from 10.1 to 10.0 in my composer.json
    and my laravel/framework from 8.22.1 to 8.21.0 as it was working fine at that point.

    
    vm:~$ php -v
    PHP 7.4.13 (cli) (built: Nov 28 2020 06:24:43) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v3.4.0, Copyright (c) Zend Technologies
        with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies
    

    my composer.json now looks like this,

    
    "laravel/framework": "^8.14",
    "laravel/passport": "^10.1",
    "lcobucci/jwt": "^3.3.3",
    
    
    
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - Conclusion: don't install laravel/passport v10.1.0
        - Installation request for laravel/passport ^10.1 -> satisfiable by laravel/passport[10.x-dev, v10.1.0].
        - Conclusion: remove lcobucci/jwt 3.3.3
        - laravel/passport 10.x-dev requires lcobucci/jwt ^3.4|^4.0 -> satisfiable by lcobucci/jwt[3.4.x-dev, 4.0.x-dev, 4.1.x-dev].
        - Can only install one of: lcobucci/jwt[3.4.x-dev, 3.3.3].
        - Can only install one of: lcobucci/jwt[4.0.x-dev, 3.3.3].
        - Can only install one of: lcobucci/jwt[4.1.x-dev, 3.3.3].
        - Installation request for lcobucci/jwt 3.3.3 -> satisfiable by lcobucci/jwt[3.3.3].
    
    

    added

    
    Updating dependencies (including require-dev)
    Package operations: 0 installs, 4 updates, 0 removals
      - Updating lcobucci/jwt (3.3.3 => 3.4.2): Loading from cache
      - Updating league/oauth2-server (8.1.1 => 8.2.4): Loading from cache
      - Updating laravel/framework (v8.21.0 => v8.22.1): Loading from cache
      - Updating laravel/passport (v10.0.0 => v10.1.0): Loading from cache
    
    

    Now it’s working just fine, you can find more details here

    Login or Signup to reply.
  2. I did composer install --no-plugins and it fixed the error for me.

    Login or Signup to reply.
  3. i had the same problem and fixed it with composer update. May u try it too.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search