How to Install PHP JSON Extension in Ubuntu 22.04?

16-Jan-2024

.

Admin

How to Install PHP JSON Extension in Ubuntu 22.04?

Hello Dev,

Today our leading topic is how to install php json extension in Ubuntu 22.04. you'll learn php extensions loaded on Ubuntu 22.04. I would like to show you how to install php-json on Ubuntu 22.04. We will look at an example of how to install php json extension in ubuntu 22.04?.

To add the PHP JSON extension using the php-json library, use the following commands for different Ubuntu versions: 22.10, 22.04, 21.10, 21.04, 20.04, and 18.04 servers.

Install PHP Json Extension in Ubuntu 22.04


Execute the following command.

sudo apt-get install php-json

Install PHP Json Extension For PHP 8.3

Execute the following command.

sudo apt-get install php8.3-json

Install PHP Json Extension For PHP 8.2

Execute the following command.

sudo apt-get install php8.2-json

Install PHP Json Extension For PHP 8.1

Execute the following command.

sudo apt-get install php8.1-json

Install PHP Json Extension For PHP 8.0

Execute the following command.

sudo apt-get install php8.0-json

Install PHP Json Extension For PHP 7.4

Execute the following command.

sudo apt-get install php7.4-json

Install PHP Json Extension For PHP 7.3

Execute the following command.

sudo apt-get install php7.3-json

Install PHP Json Extension For PHP 7.2

Execute the following command.

sudo apt-get install php7.2-json

Restart Apache Server

Use the following command to restart the Apache2 server.

sudo service apache2 restart

Check php-json Extension Installed

Here, execute the following command to verify whether the extension is installed.

php -m | grep -i json

Verify the activation of the JSON extension by creating a PHP file with the following content and accessing it through your web browser.

<?php

phpinfo();

?>

nspect the section that references 'json.' If it is identified, the extension is successfully installed and active.

I hope it can help you...

#Ubuntu