PHP Warning: PHP Startup: Unable to load dynamic library 'mcrypt.so'

前端 未结 6 1292
广开言路
广开言路 2021-01-05 11:19

I am trying to update laravel using composer update on ubuntu 06.04 but everytime i run composer update this warning always comes up.

PHP Warnin         


        
相关标签:
6条回答
  • 2021-01-05 12:03

    For (>= PHP 7.3) you can use the following command:

    sudo pecl install mcrypt-1.0.2
    
    0 讨论(0)
  • 2021-01-05 12:05

    First, open up a terminal window and install the necessary dependencies with the commands:

    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
    

    And there you go. Mcrypt is now installed. Go back to the process of installing whatever server software that depends upon this extension and you should be good to go.

    0 讨论(0)
  • 2021-01-05 12:09

    I faced this problem when I upgraded my PHP to 7.3

    I found mcrypt.so was still present in /etc/php/7.3 that should not be as it is deprecated in php 7.3 so just deleting mcrypt.so from /etc/php/7.3 solved issue.

    I used following commands:

    cd /etc/php/7.3

    sudo rm -rf mcrypt.so

    sudo service apache2 restart

    0 讨论(0)
  • 2021-01-05 12:15

    I faced similar issue when I installed Php7.2 on Ubuntu 18. Though I had installed mcrypt using PECL still I get the error mentioned in the question.

    I did following to fix it

    sudo apt-get install php-pear php7.2-dev
    

    then uninstalled

    pecl uninstall mcrypt
    

    Now reinstall mcrypt

    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 using 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
    

    Now restart Apache

    sudo service apache2 restart
    

    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"
    
    0 讨论(0)
  • 2021-01-05 12:15

    Also, if you're using php 7.2 & are getting this error and you know do not want/need mcrypt, but do not know how to exclude it.... You need edit your php.ini file and either comment this out by using a semi-colon in front of it:

    ; extension=mcrypt.so
    

    or just delete that line entirely.

    0 讨论(0)
  • 2021-01-05 12:17

    İts is worked for me.

    export LC_ALL="C"

    export LANG="C

    sudo pecl install mcrypt-1.0.1

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