Install PHP 7.2 mcrypt extension on CWP Server

The mcrypt extension has been abandonware for nearly a decade and was deprecated in PHP 7.1, It has been removed from PHP 7.2. On PHP 7.2 or newer, you can manually install mcrypt from PCEL if you use legacy PHP code that still uses outdated mcrypt extension.

To install PHP mcrypt module on PHP 7.2 in CWP server, do the following.

cd /usr/local/src
tar xvf mcrypt-1.0.4.tgz
cd mcrypt-1.0.4
./configure -with-php-config=/opt/alt/php72/usr/bin/php-config
make install

This will install the extension in folder /opt/alt/php72/usr/lib/php/extensions/no-debug-non-zts-20170718/. Copy it to php-fpm extension folder.

cp /opt/alt/php72/usr/lib/php/extensions/no-debug-non-zts-20170718/ /opt/alt/php-fpm72/usr/lib/php/extensions/no-debug-non-zts-20170718/

Create file mcrypt.ini for both php-fpm and php cli.

echo "" > /opt/alt/php72/usr/php/php.d/mcrypt.ini
echo "" > /opt/alt/php-fpm72/usr/php/php.d//mcrypt.ini

Now you need to restart php-fpm with command

systemctl restart php-fpm72

Or though CWP admin area

CWP Admin > PHP Settings > PHP-FPM Selector

centos panel restart php-fpm service

Back to CentOS Web Panel (CWP)

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *