To install mcrypt extension for PHP 8*-fpm, you can follow these steps:
1. Update your system:
sudo apt update sudo apt upgrade
2. Install required dependencies:
sudo apt install gcc make autoconf libc-dev pkg-config
3. Install the libmcrypt library:
sudo apt install libmcrypt-dev
4. Download the mcrypt source code from the libmcrypt GitHub repository:
git clone https://github.com/libmcrypt/libmcrypt.git
5. Go to the downloaded directory:
cd libmcrypt
6. Configure and install the library:
./autogen.sh ./configure make sudo make install
7. 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
8. 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
9. 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
.
10. Save the file and exit the text editor.
11. 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.