How install mcrypt in version 8*-fpm?

To install mcrypt extension for PHP 8*-fpm, you can follow these steps:

  1. Update your system:
   sudo apt update
   sudo apt upgrade
  1. Install required dependencies:
   sudo apt install gcc make autoconf libc-dev pkg-config
  1. Install the libmcrypt library:
   sudo apt install libmcrypt-dev
  1. Download the mcrypt source code from the libmcrypt GitHub repository:
   git clone https://github.com/libmcrypt/libmcrypt.git
  1. Go to the downloaded directory:
   cd libmcrypt
  1. Configure and install the library:
   ./autogen.sh
   ./configure
   make
   sudo make install
  1. Once the installation of libmcrypt is complete, you can install the PHP mcrypt extension using pecl (PEAR's Extension Community Library):
   sudo pecl install mcrypt
  1. After the installation, you need to activate the mcrypt extension in the PHP configuration. Open the php.ini file using your preferred text editor:
   sudo nano /etc/php/{PHP_VERSION}/fpm/php.ini
  1. Add the following line at the end of the file:
   extension=mcrypt.so

Replace {PHP_VERSION} with the actual version of PHP you are using, like 7.4 or 8.0.

  1. Save the file and exit the text editor.
  1. Restart the PHP-FPM service for the changes to take effect:
   sudo systemctl restart php-fpm

After completing these steps, the mcrypt extension should be successfully installed and enabled for PHP 8*-fpm. You can verify the installation by running php -m and checking if mcrypt appears in the list of loaded modules.