Need to know how to install MCRYPT on UBUNTU with PHP Version 7.3? This is how…

MCrypt install on PHP 7.3

The process is pretty simple. This example installs the library on UBUNTU 16.

Highlights

  • Install PECL
  • Install the MCRYPT library (version 1.0.2)
  • Declare library in PHP.INI
  • Restart Apache

Details

Step 1. Install PECL Check if PECL is installed

$ pear version

If not installed, install it now.

$ sudo apt install -y pear

Step 2. Install the MCRYPT library (version 1.0.2)

$ pecl install mcrypt-1.0.2

Declare library in PHP.INI Find the PHP.INI file.

$ php -v

You’ll see something that looks like:

PHP 7.3.22-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Sep  9 2020 06:46:12) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.22, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.22-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Open the PHP.INI file and add the library.

$ vi /etc/php/7.3/apache2/php.ini

In the ‘Dynamic Extensions’ section, add the library.

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

;extension=example.so
extension=mcrypt.so  ;new line declaring the library

Step 3. Restart Apache

$ sudo service apache2 restart