How can I install mcrypt under PHP7? Laravel needs it

前端 未结 9 1111
盖世英雄少女心
盖世英雄少女心 2020-12-01 04:16

Since Laravel4 requires mcrypt extension, and PHP7 doesn\'t seem to have mcrypt extension, is there any workaround for this to work?

相关标签:
9条回答
  • 2020-12-01 04:58

    I use, Dotdeb, an extra repository providing up-to-date all kinds of cool toys for your Debian servers like Nginx, PHP, MySQL, Redis etc.

    1. Update your sources.list

      deb http://packages.dotdeb.org {distribution} all 
      deb-src http://packages.dotdeb.org {distribution} all
      
    2. GnuPG keys

      wget https://www.dotdeb.org/dotdeb.gpg
      sudo apt-key add dotdeb.gpg
      
    3. Update apt & build something amazing.

      sudo apt-get update
      
    0 讨论(0)
  • 2020-12-01 05:00

    PHP7 contains mcrypt extension internally (source-path/ext/mcrypt/). But it depends on Libmcrypt soft.

    Step 1.

    Download libmcrypt-x.x.tar.gz from http://mcrypt.sourceforge.net/ and build it.

    cd libmcrypt-x.x
    ./configure
    make
    make install
    

    Step 2.

    Rebuild PHP7 from source and add --with-mcrypt option.

    ./configure ... --with-mcrypt
    

    Other way without rebuilding PHP7

    cd php7-source-path/ext/mcrypt/
    /php7-path/bin/phpize
    ./configure --with-php-config=/php7-path/bin/php-config
    make && make install
    echo "extension=mcrypt.so" >> /php7-path/ext/php.ini
    

    Restart php

    0 讨论(0)
  • 2020-12-01 05:02

    On ubuntu: According to launchpad.net the package for mcrypt is called php7.0-mcrypt.

    sudo apt-get install php7.0-mcrypt to install

    0 讨论(0)
提交回复
热议问题