3

I use a minimal server environment of ubuntu16.04.1, Apache2, MySQL and PHP 7.0.8.1. I've installem AMP via: apt-get install lamp-server^.

I also installed PHPmyadmin manually via:

cd /var/www/html
wget https://files.phpmyadmin.net/phpMyAdmin/4.6.5.2/phpMyAdmin-4.6.5.2-all-languages.zip
find ./ -type f -name '*phpMyAdmin*.zip' -exec unzip {} \; # We can also do unzip \*phpMyAdmin*.zip ...
find ./ -type d -name 'phpMyAdmin-*' -exec mv {} phpmyadmin \;

PHPmyadmin is bootstrapped but to use it fully functionally, AFAIK I aslo need to do:

phpenmod mcrypt
phpenmod mbstring

Yet these respectively return errors:

Module mcrypt ini file doesn't exist under /etc/php/7.0/mods-available

Module mbstring ini file doesn't exist under /etc/php/7.0/mods-available

I never had these errors before. Are these modules redundant for PHPmyadmin in current releases or when not installed via apt-get install?

3 Answers3

12

Install them first:

sudo apt install php7.0-mcrypt && sudo apt install php7.0-mbstring

Then enable them with:

sudo a2enmod mcrypt
sudo a2enmod mbstring

Update

Based on the extensive research I believe a bug exist that prevents your php cli working well with php mcrypt.

Source:

Can't use PHP extension Mcrypt in Ubuntu 13.10 (Nginx, PHP-FPM)

php is not working well on ubuntu 13.10 and mcrypt is missing in phpmyadmin

To confirm that mcrypt is enabled in apache follow these steps:

  1. Create a php file called info.php put this code in it:

    <?php echo phpinfo(); ?>
    
  2. Put the file in /var/www/html or your server root

  3. Access it from the brower at say IP/info.php or localhost/info.php

  4. Look at the out and you will find that mcrypt and mbstring are enabled

    enter image description here

    As you can see, its enabled in apache, but inaccessible from php CLI hence the error messages.

  5. To confirm its working [as I have this problem also] I did the following:

    • installed prestashop application, and since one of the requirements of prestashop is php mcrypt it would have thrown an error and refused to proceed if mcrypt was not enabled on apache.

Simple put based on your the if your apache information page displays these modules as enabled then it is. The error seen are a result of php CLI having issues with mcrypt which has been noted to be a bug. Seen in earlier versions of php but now present in php 7

George Udosen
  • 37,534
5

I had issues with the above solutions but found this:

https://www.techrepublic.com/article/how-to-install-mcrypt-for-php-7-2/

Essentially, build it yourself:

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install php7.2-dev
sudo apt-get -y install libmcrypt-dev

Once the dependencies have been installed, you can install mcrypt with the command:

sudo pecl install mcrypt-1.0.1

From there I needed to add:

 /etc/php/7.2/mods-available/mcrypt.ini

Which looked like this:

; configuration for php mcrypt module
; priority=20
extension=mcrypt.so

Then

sudo phpenmod mcrypt
sudo systemctl restart apache2.service
theINtoy
  • 151
1

If their both installed and the error persist, Try to make a symlink to ini files in mods-available

Here is how to do it:

sudo ln -s /etc/php7/conf.d/mcrypt.ini /etc/php/7.0/mods-available/mcrypt.ini

sudo ln -s /etc/php7/conf.d/mbstring.ini /etc/php/7.0/mods-available/mbstring.ini