Issue in installing php7.2-mcrypt

前端 未结 5 680
伪装坚强ぢ
伪装坚强ぢ 2020-11-29 01:15

As I\'m trying to load mcrypt extension module from PHP 7.2.X version.
So I tried to make use of PECL library that is compatible to the current version of my PHP, in ord

相关标签:
5条回答
  • 2020-11-29 02:06

    I followed below steps to install mcrypt for PHP7.2 using PECL.

    1. Install PECL

    apt-get install php-pecl

    1. Before installing MCRYPT you must install libmcrypt

    apt-get install libmcrypt-dev libreadline-dev

    1. Install MCRYPT 1.0.1 using PECL

    pecl install mcrypt-1.0.1

    1. After the successful installation

    You should add "extension=mcrypt.so" to php.ini

    Please comment below if you need any assistance. :-)

    IMPORTANT !

    According to php.net reference many (all) mcrypt functions have been DEPRECATED as of PHP 7.1.0. Relying on this function is highly discouraged.

    0 讨论(0)
  • 2020-11-29 02:08

    As an alternative, you can install 7.1 version of mcrypt and create a symbolic link to it:

    Install php7.1-mcrypt:

    sudo apt install php7.1-mcrypt
    

    Create a symbolic link:

    sudo ln -s /etc/php/7.1/mods-available/mcrypt.ini /etc/php/7.2/mods-available
    

    After enabling mcrypt by sudo phpenmod mcrypt, it gets available.

    0 讨论(0)
  • 2020-11-29 02:09

    @praneeth-nidarshan has covered mostly all the steps, except some:

    • Check if you have pear installed (or install):

    $ sudo apt-get install php-pear

    • Install, if isn't already installed, php7.2-dev, in order to avoid the error:

    sh: phpize: not found

    ERROR: `phpize’ failed

    $ sudo apt-get install php7.2-dev

    • Install mcrypt using pecl:

    $ sudo pecl install mcrypt-1.0.1

    • Add the extention extension=mcrypt.so to your php.ini configuration file; if you don't know where it is, search with:

    $ sudo php -i | grep 'Configuration File'

    0 讨论(0)
  • 2020-11-29 02:09
    sudo apt-get install php-pear php7.x-dev
    

    x is your php version like 7.2 the php7.2-dev

    apt-get install libmcrypt-dev libreadline-dev
    pecl install mcrypt-1.0.1 
    

    then add "extension=mcrypt.so" in "/etc/php/7.2/apache2/php.ini"

    here php.ini is depends on your php installatio and apache used php version.

    0 讨论(0)
  • 2020-11-29 02:15

    Mcrypt PECL extenstion

     sudo apt-get -y install gcc make autoconf libc-dev pkg-config
     sudo apt-get -y install libmcrypt-dev
     sudo pecl install mcrypt-1.0.1
    

    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 '/usr/lib/php/20170718/mcrypt.so'    ---->   this is our path to mcrypt extension lib
    install ok: channel://pecl.php.net/mcrypt-1.0.1
    configuration option "php_ini" is not set to php.ini location
    You should add "extension=mcrypt.so" to php.ini
    

    Grab installing path and add to cli and apache2 php.ini configuration.

    sudo bash -c "echo extension=/usr/lib/php/20170718/mcrypt.so > /etc/php/7.2/cli/conf.d/mcrypt.ini"
    sudo bash -c "echo extension=/usr/lib/php/20170718/mcrypt.so > /etc/php/7.2/apache2/conf.d/mcrypt.ini"
    

    Verify that the extension was installed

    Run command:

    php -i | grep "mcrypt"
    

    The output will look like this:

    /etc/php/7.2/cli/conf.d/mcrypt.ini
    Registered Stream Filters => zlib.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, convert.iconv.*, mcrypt.*, mdecrypt.*
    mcrypt
    mcrypt support => enabled
    mcrypt_filter support => enabled
    mcrypt.algorithms_dir => no value => no value
    mcrypt.modes_dir => no value => no value
    
    0 讨论(0)
提交回复
热议问题