9

I'm a PHP web developer I have some errors with new version of ubuntu, I was Installed new version of Ubuntu (22.10) but when I installed php 8.2 version I can't know how to install different version of PHP.

For example I tried to install php 8.0, 7.4, 7.0, 7.2 , ... but nothing happened I was tried many ways, please if someone know how to install multiple versions in ubuntu 22.10 ask me.

Thank You.

2 Answers2

10

You can try this step :

  1. Add PPA for PHP

    sudo apt install software-properties-common
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update

  2. Install PHP8.0

    sudo apt install php8.0

  3. Install PHP 8 Packages That You Need Example :

    sudo apt install php8.0-common php8.0-mysql php8.0-xml

  4. Enable PHP 8 and Restart Your Apache

    sudo a2dismod php8.2
    sudo a2enmod php8.0

  5. Check php version that now running

    php -v

If it’s still show old php version then you can run bellow command and choose new php version from there list. so run bellow command:

sudo update-alternatives --config php

Repeat that step for another version that you want to running with your apache.

Hope this help. Thanks

0

Try to take a look here (is for Ubuntu 22.04 but I think it would be OK for 22.10 too):

https://techvblogs.com/blog/install-multiple-php-versions-on-ubuntu-22-04

maxwatt
  • 508