Score:0

How I can install multiple versions of php in ubuntu 22.10 version?

cg flag

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.

in flag
If you are familiar with Docker containers, they are ideal for this sort of situation. I can have several containers running simultaneously, each with different versions of PHP, each reading the same source files. This allows for some excellent unit testing
Score:1
us flag

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

Score:0
id flag

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

John Hanley avatar
in flag
Links change and break. Answers should be self-contained and not require leaving the site. Please delete this answer and post a comment to the question. https://askubuntu.com/help/how-to-answer
Score:0
gg flag

When it comes to managing packages and handling multiple versions in different operating systems, the experience can vary greatly. While Windows offers a smooth experience, Mac and Linux can be challenging, especially if you are not familiar with Linux commands.

One solution to this is using the "brew" package manager, which provides a range of useful functionalities for managing packages and multiple versions. This is a great alternative to other package managers such as "apt" or custom repositories.

Click to learn more about Homebrew

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.