Ubuntu 16.04.3 LTS安装phpMyAdmin时phpenmod mcrypt报错求解决方案
Hey there, let's tackle this mcrypt issue you're facing while setting up phpMyAdmin. The error pops up because mcrypt was deprecated starting in PHP 7.2 and isn't included by default in the standard packages for Ubuntu 16.04. Here's how to resolve it properly:
First, install the PHP 7.2 mcrypt extension package. Run these commands in your terminal:
sudo apt-get update sudo apt-get install php7.2-mcryptThis will pull down the necessary files for the extension.
If the error still persists after installation, it means the ini file for mcrypt wasn't automatically created. Let's manually set it up:
First, confirm the location of the
mcrypt.sofile (PHP 7.2's extension directory typically uses the20170718suffix):find /usr/lib/php/20170718/ -name mcrypt.soIf this path doesn't exist, replace
20170718with the actual directory name you see under/usr/lib/php/.Create the mcrypt ini file in the mods-available directory:
sudo nano /etc/php/7.2/mods-available/mcrypt.iniInside the file, add this single line:
extension=mcrypt.soSave and exit the editor (for nano, press
Ctrl+O, hit enter, thenCtrl+X).
Now run the
phpenmodcommand again—it should work without errors:sudo phpenmod mcryptFinally, restart Apache to apply the changes:
sudo systemctl restart apache2
A quick note: Since mcrypt is deprecated in PHP 7.2 and later, consider exploring alternatives like OpenSSL for future projects. But for phpMyAdmin compatibility on your current setup, this fix will get you up and running.
内容的提问来源于stack exchange,提问作者Fil

