DEV Community

Brent Vanwildemeersch
Brent Vanwildemeersch

Posted on


How to change your PHP version on Ubuntu 22.04


This is a guide to change your PHP version through the command line on Ubuntu 22.04

Installed versions list

To list all the installed PHP versions on your local device, use the following command :

sudo update-alternatives --config php
Enter fullscreen mode Exit fullscreen mode

Change active PHP version

To change your currently used PHP version to a different version (that is installed), you can use the following command:

sudo update-alternatives --set php /usr/bin/php${version}
Enter fullscreen mode Exit fullscreen mode

Top comments (3)

cavo789 profile image
Christophe Avonture

Hi ! On fact this question didn't exist anymore as soon as you use Docker. Just use the image with the version you want and tadaaa. If you are a web developer, take time to follow a tutorial, you'll not regret I think.

vanwildemeerschbrent profile image
Brent Vanwildemeersch

Thanks for the tip, will look into it

pthaiitdev profile image
Phạm Tiến Hải

you save my day

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.