How to install the php-mcrypt module on a Plesk server

Follow

Comments

13 comments

  • Avatar
    Daria Gavrilova

    Hello @eurogood,

    Thank you for your input.

    Indeed mcrypt_compat can be used, however, please note that it was not tested with Plesk yet and mcrypt_compat can be installed on your own risk only.

    0
    Comment actions Permalink
  • Avatar
    ibrahim sayar

    nice content, i tried it works !

    0
    Comment actions Permalink
  • Avatar
    Ryan Johnson (Edited )

    This is out of date by a long shot, even though it says you updated it a month ago. Plesk 7.4.7 uses mcrypt-1.0.3 when installing via pecl:

    # /opt/plesk/php/7.4/bin/pecl install mcrypt-1.0.3

    Also, your instruction assumes the user uses apache2, when this is a bad assumption. I use nginx, because Apache is old and slow and limited. Corrections:

    # service nginx reload
    # service plesk-php74-fpm reload
    0
    Comment actions Permalink
  • Avatar
    Jacob Bowen

    Mcrypt updated to 1.0.2 which is fully compatible with 7.2 and 7.3. Please update 

    0
    Comment actions Permalink
  • Avatar
    Webbing

    On the 2nd line for CentOS

    yum install --enablerepo=epel -y plesk-php72-devel gcc libmcrypt-devel

    ... you need to add the "make" library well in order to be able to compile.

    0
    Comment actions Permalink
  • Avatar
    eurogood

    It seems like https://github.com/phpseclib/mcrypt_compat might be the ideal option when mcrypt isn't available.

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Webbing

    Thank you for the clarification.

    I've updated the article with "make" installation. If make is already present, it will be updated.

    BTW, on a test server, I have CentOS 8.1.1911 and "make" was present =)

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello,

    Thank you for the message, this may be useful for other Pleskians.

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @Ryan Johnson

    Thank you for your comment, I have updated the article accordingly.

    0
    Comment actions Permalink
  • Avatar
    Webbing

    Ivan Postnikov apparently not if you are installing it on CentOS 8.2. I ran into this issue last week...

    0
    Comment actions Permalink
  • Avatar
    VG

    Hi,

     

    This article it's incomplete. In order to build the library, C++ compiler is needed. If you don't have it, builder will fail. Btw, today the stable working version is 1.0.3.

     

    Adapted from Stackoverflow thread:

     

    Install dependencies and mcrypt library with pecl

     sudo apt-get -y install gcc make autoconf libc-dev pkg-config
     sudo apt-get -y install libmcrypt-dev plesk-php72-devel
     sudo pecl install mcrypt-1.0.3

    When you are shown the prompt

    libmcrypt prefix? [autodetect] :

    Press [Enter] to autodetect.

    After success installing mcrypt trought pecl, you should add mcrypt.so extension to php.ini.

    The output will look like this:

    ...
    Build process completed successfully
    Installing '/opt/plesk/php/7.2/lib/php/modules/mcrypt.so'    ---->   this is our path to mcrypt extension lib
    install ok: channel://pecl.php.net/mcrypt-1.0.3
    configuration option "php_ini" is not set to php.ini location
    You should add "extension=mcrypt.so" to php.ini

    Enable the extension in PHP configuration:

     echo 'extension=mcrypt.so' > /opt/plesk/php/7.2/etc/php.d/mcrypt.ini

    Refresh and Reload

     sudo plesk bin php_handler --reread
    sudo service apache2 reload
    sudo service plesk-php72-fpm reload

    Check that everything is working

    php -i | grep "mcrypt"

     

    Cheers

     

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello Webbing

    "make" is included in the minimal CentOS installation, for example: https://gist.github.com/ozuma/552276c5d8e38b72f91d

    I've also verified it on a test server.

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Jacob,

    Thank you, I've created a corresponding feature suggestion: https://plesk.uservoice.com/forums/184549-feature-suggestions/suggestions/38282788-add-mcrypt-module-to-plesk-php-7-2-and-newer?

    Feel free to vote for and comment it.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request