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

前端 未结 6 1338
广开言路
广开言路 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: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"
    

提交回复
热议问题