Readytocode
  • Home
  • Laravel
  • PHP
  • React Js
  • Git
  • Server
Facebook X (Twitter) Instagram
Readytocode
  • Home
  • Laravel
  • PHP
  • React Js
  • Git
  • Server
Facebook X (Twitter) Instagram Pinterest LinkedIn Reddit
Readytocode
You are at:Home How To Install PHP on Ubuntu 22.04

Server

How To Install PHP on Ubuntu 22.04

JustinBy JustinMay 7, 2022No Comments2 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr Email




Hello Developers, In this post i will guide you how to install PHP on Ubuntu 22.04, Here we will install latest php8.1.

I will also guide you how to install other older php on Ubuntu 22.04.

Get Ready:

Login to Terminal with Root user access.

$ sudo apt update && sudo apt upgrade

When ever prompted for your permission press Y and hit enter.

Install PHP on Ubuntu 22.04


Step 1.
Install some dependency which are required for Installation.

$ sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https


Step 2
. Adding the Ondrej PPA to our system, which have all versions of PHP.

$ LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php


Step 3
. Again Update PHP package manager.

$ sudo apt update

 

Step 4. Install PHP 8.1

$ sudo apt install php8.1

Note: If you want to install another Version of PHP just change the version number on above command like below

$ sudo apt install php7.4

 

Step 5. Install PHP package which are required by PHP.

$ sudo apt install php8.1-mysql php8.1-mbstring php8.1-xml php8.1-curl

 

Step 6. Check installed or Not?

$ php -v

This will give you output like below message

PHP 8.1.5 (cli) (built: Apr 21 2022 10:32:13) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.5, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.5, Copyright (c), by Zend Technologies

 

 

Suppose you have old php Version then how to uninstall that, Check below command for uninstall Process.

$ sudo apt remove php7.4

and its module uninstallation

$ sudo apt remove php7.4-*

 

Thanks and Happy Coding.

 

 

Total
1
Shares
Share 0
Tweet 0
Pin it 1
Share 0

Like this:

Like Loading...

Related

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Justin
  • Website

Related Posts

How to install Steam on Ubuntu 22.04 step by step

April 20, 2023

What is, How to Install & Use Kali Linux

April 1, 2023

ufw status inactive on Ubuntu 22.04

March 30, 2023

Leave A Reply Cancel Reply

Featured Posts
  • Why meta tag is important for seo 1
    How to change react Page title, Page Description and some other meta Tag
    • August 4, 2023
  • 2
    How to Generate image from text with Laravel 10
    • May 16, 2023
  • Laravel 10 Restrict User Access 3
    Laravel 10 Restrict User Access
    • May 3, 2023
  • Laravel 10 Pagination Example 4
    Laravel 10 Pagination Example
    • May 3, 2023
  • install Steam on Ubuntu 5
    How to install Steam on Ubuntu 22.04 step by step
    • April 20, 2023



Readytocode
Facebook X (Twitter) Instagram Pinterest
  • About Us
  • Privacy Policy
© 2025 ReadyToCode.

Type above and press Enter to search. Press Esc to cancel.

%d