Open In App

How to Install PHP Extension in Ubuntu?

Last Updated : 14 Feb, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

PHP extensions are compiled libraries that allow you to use special functions in your PHP code. PHP extensions can be compiled statically in PHP or dynamically loaded at the time of execution. By using extensions, you can prevent the need to recreate the same code for many applications. To use an extension, all you need to do is connect it to the PHP binary of your application. You can use publicly available PHP extensions or create your own:  

  • To provide different types of functions or classes to work with data structures like strings, arrays, objects, lists, and graphs.
  • To facilitate processes with external services using technologies like XML-RPC and SOAP.
  • To add new functionality to your application, including caching, debugging, profiling, testing, etc.
  • To increase security by using hashing or encrypting data using technologies such as OpenSSL.

Verify PHP extension installation on Ubuntu

Open the terminal on your Ubuntu system and type the following command to check whether your extension is installed or not.

dpkg –list | grep <extension-name> 

Replace <extension-name> with your actual extension name. For example :- dpkg –list | grep php-intl

Verify-PHP-extension-installation

If there is no result like shown in the above image, then follow the steps below to install your PHP extension.

Installation of PHP extension in Ubuntu

To install the PHP extension in Ubuntu follows the following steps:

Step 1: Update your system packages using the following command:

sudo apt-get update -y

Update-your-system-packages

Step 2: Run the following command for installing your PHP extension:

sudo apt-get install -y <php-extension>

Here, replace <extension-name> with your actual extension name. For example:- sudo apt-get install -y php-intl

Installing-PHP-extension

Now again verify the installation of the PHP extension using the following command:

dpkg –list | grep <extension-name> 

Verify-the-installation-of-the-PHP-extension

So this is how we can install PHP extension in Ubuntu.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads