How To Install PHP 7.3 on Ubuntu 22.04

In this tutorial, we want to teach you How To Install PHP 7.3 on Ubuntu 22.04.

PHP 7.3 introduced a number of syntax features to make development easier, added the ability to throw an exception when parsing or encoding JSON, added support for same-site cookies, improved FastCGI Process Manager (php-fpm) logging, expanded LDAP controls, provided case-mapping and case-folding support in mbstring functions, provided some improvements to password hashing, and updated its PCRE library.

Steps To Install PHP 7.3 on Ubuntu 22.04

To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Ubuntu 22.04.

Add PPA Ondrej Repository on Ubuntu 22.04

Here we will install PHP 7.3 from the PPA repository.

PPA stands for Personal Package Archive. The PPA allows application developers and Linux users to create their own repositories to distribute software. With PPA, you can easily get newer software versions or software that are not available via the official Ubuntu repositories.

First, add the PPA repo on Ubuntu 22.04 with the following command:

sudo add-apt-repository ppa:ondrej/php

Then, update your local package index with the command below:

sudo apt-get update

Install PHP 7.3 on Ubuntu 22.04

Now you can use the following command to install PHP 7.3:

sudo apt-get install -y php7.3

Verify PHP 7.3 Installation

When you are done, check your PHP 7.3 installation by checking its version:

php -v

In your output you will see:

Output
PHP 7.3.33-8+ubuntu22.04.1+deb.sury.org+1 (cli) (built: Oct 28 2022 18:26:03) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.33-8+ubuntu22.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

php.ini Configuration Files on Ubuntu 22.04

The location of the PHP installed on your Ubuntu 22.04 is /etc/php/7.3.

There are two ini configuration files for PHP. One for the CLI (Command-line interface) and another for the Web (Apache2).

#/etc/php/7.3/apache2/php.ini 
#/etc/php/7.3/cli/php.ini

The ini modules files for PHP on Ubuntu 22.04 are located in the:

/etc/php/7.3/mods-available/pods.ini
/etc/php/7.3/mods-available/json.ini
...

Also, you can list available modules with PHP with the command below:

php -m

In your output you will see:

Output
[PHP Modules]
calendar
Core
ctype
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib
[Zend Modules]
Zend OPcache

The executable PHP binaries on Ubuntu 22.04 are located in the:

/usr/bin/php
/usr/bin/php7.3

For more information, you can visit the PHP Documentation page.

Conclusion

At this point, you have learned to Install PHP 7.3 on Ubuntu 22.04.

Hope you enjoy it.

You may be like these articles:

How To Install PHP 7.4 on Ubuntu 22.04

How To Install PHP 7.4 on AlmaLinux 8

Install PHP 7.4 on Debian 11

3 COMMENTS
  1. Awesome things here. I’m very glad to see
    your article. Thank you so much and I am looking forward to contact you.
    Will you please drop me a e-mail?

LEAVE A REPLY

Please enter your comment!
Please enter your name here
Captcha verification failed!
CAPTCHA user score failed. Please contact us!
Latest Articles

POPULAR TAGS

Most Popular