skip to Main Content

I am using an ubuntu digitalocean droplet as a web application server. I have 2 active applications that require php8.0 and above but I want to deploy a third application that requires php8.1.

I have installed php8.1 and edited my nginx configuration for each application to usephp8.1. Ran php -v command and the active version is still php8.0

How can I switch to php8.1?

enter image description here

2

Answers


  1. Your default PHP 8.0:

    php -v
    

    Run installed PHP 8.1:

    /usr/bin/php8.1 -v
    

    You can switch active version by:

    sudo update-alternatives --config php
    

    Output

    There are 2 choices for the alternative php (providing /usr/bin/php).
    
      Selection    Path             Priority   Status
    ------------------------------------------------------------
      0            /usr/bin/php8.0   80        auto mode
      1            /usr/bin/php8.1   70        manual mode
    * 2            /usr/bin/php8.0   80        manual mode
    
    Press <enter> to keep the current choice[*], or type selection number: 1
    update-alternatives: using /usr/bin/php8.1 to provide /usr/bin/php (php) in manual mode
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search