How to Install PHP Extension in Ubuntu?
Last Updated :
14 Feb, 2022
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
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
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
Now again verify the installation of the PHP extension using the following command:
dpkg --list | grep <extension-name>
So this is how we can install PHP extension in Ubuntu.
Similar Reads
How to Install PHP intl extension in Ubuntu? The Internationalisation (Intl) extension is a wrapper for the ICU library, a collection of C/C++ and Java libraries that provide Unicode and Globalisation support for software applications. It tends to closely follow ICU APIs so that people having experience working with ICU in either C/C++ or Java
2 min read
How to Install mcrypt extension on Ubuntu? PHP mcrypt is an extension. It provides encryption facilities for web applications that require the functionality of modern algorithms such as AES. It works as interface to Mcryptâs libmcrypt library which implements all the algorithms and modes available in it like GOST, RC2, RC6, MARS, etc. Here,
3 min read
How to Install PHP Extension in cPanel? PHP (Hypertext Preprocessor) is known as a broadly useful prearranging language that can be utilized to foster dynamic and intelligent sites. It was among the main server-side dialects that could be inserted into HTML, making it more straightforward to add usefulness to pages without expecting to ca
1 min read
How to Install PHP Soap Extension? PHP is a general-purpose scripting language that is mainly used for Web development to built dynamic and interactive web pages. Because of its free availability and efficiency, it is widely used among web developers. It has many extensions to get and use web services to make the website more interac
3 min read
How to Install php-xml in Ubuntu? Extensible Markup Language (XML) is a markup language similar to HTML, but the difference between HTML and XML is HTML has predefined tags but in XML we can create our own tags. The format of XML is standardized, if we share or transmit the XML over other systems and platform the receiver still will
2 min read