How can I install mcrypt under PHP7? Laravel needs it

前端 未结 9 1147
盖世英雄少女心
盖世英雄少女心 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 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

提交回复
热议问题