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 wget https://pecl.php.net/get/mcrypt-1.0.4.tgz tar xvf mcrypt-1.0.4.tgz cd mcrypt-1.0.4 /opt/alt/php72/usr/bin/phpize ./configure -with-php-config=/opt/alt/php72/usr/bin/php-config make 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/mcrypt.so /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 "extension=mcrypt.so" > /opt/alt/php72/usr/php/php.d/mcrypt.ini echo "extension=mcrypt.so" > /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
Back to CentOS Web Panel (CWP)