How to switch from php8.1 to php8.2 version in ubuntu

Created at 17-Mar-2024 , By samar

Let's we have two php version php8.1 and php8.2 and i want to switch php version from php8.1 to php8.2. Here is step by step instructions to use different php version as per your project requirement at different time.

  • Swith php version form php8.1 to php8.2

    First, disable the currently enabled PHP version Apache module. Lets i am working on php8.1 and now i want to switch to php8.2 so first we have to disable the php8.1 version and enable the php8.2 and restart the apache2 server.

    To switch from one version to another php version you have to install the Apache modules for PHP 8.1 and PHP 8.2 using sudo apt install libapache2-mod-php8.1 libapache2-mod-php8.2 command. This command installs the Apache modules for PHP 8.1 and PHP 8.2, which allow Apache to interpret PHP code using the respective PHP versions.

    Disable php8.1 first

    sudo a2dismod php8.1

    Enable php8.2

    sudo a2enmod php8.2

    Restart apache2 server

    sudo systemctl restart apache2

Back to code snippet queries related cmd

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.