Now Reading
How To Install MCrypt For PHP 7 On Ubuntu 20.04 LTS
Dark Light

How To Install MCrypt For PHP 7 On Ubuntu 20.04 LTS

Avatar

If you using the most recent versions of PHP and your project depends on MCrypt, you will get the error specific to Encrypt library which requires MCrypt extension. The main reason for missing MCrypt is that PHP no longer provides it by default and we must explicitly install it in order to continue using it. Notes: This tutorial assumes that most recent version of PHP is already installed on the system. You can also follow the tutorial How To Install PHP 7 On Ubuntu 20.04 LTS to install PHP 7 on Ubuntu. Install PHP Dev Install the PHP development package using the below-mentioned command. sudo apt install php7.4-dev Install Build Tools Install the build tools using the below-mentioned command. sudo apt -y install gcc make autoconf libc-dev pkg-config Install MCrypt Dev Install the MCrypt development package using the below-mentioned command. sudo apt-get -y install libmcrypt-dev Install MCrypt Install the most recent version of MCrypt using the below-mentioned command. # Install MCryptsudo pecl install mcrypt-1.0.3# OutputNotice: Trying to access array offset on value of type bool in PEAR/REST.php on line 187PHP Notice: Trying to access array offset on value of type bool in /usr/share/php/PEAR/REST.php on line 187WARNING: channel “pecl.php.net” has updated its protocols, use “pecl channel-update pecl.php.net” to updatedownloading mcrypt-1.0.3.tgz …Starting to download mcrypt-1.0.3.tgz (33,590 bytes)………done: 33,590 bytes6 source files, buildingrunning: phpizeConfiguring for:PHP Api Version: 20190902Zend Module Api No: 20190902Zend Extension Api No: 320190902——–# Press enter on command prompt to complete installationlibmcrypt prefix? [autodetect] : It will complete the installation and shows the success message as shown below. Build process completed successfullyInstalling ‘/usr/lib/php/20190902/mcrypt.so’install ok: channel://pecl.php.net/mcrypt-1.0.3configuration option “php_ini” is not set to php.ini locationYou should add “extension=mcrypt.so” to php.ini Configure PHP Now configure the PHP by updating the php.ini file using the below-mentioned commands. sudo bash -c “echo extension=/usr/lib/php/20190902/mcrypt.so > /etc/php/7.4/cli/conf.d/mcrypt.ini”sudo bash -c “echo extension=/usr/lib/php/20190902/mcrypt.so > /etc/php/7.4/apache2/conf.d/mcrypt.ini” At last, test your installation. # Verify MCryptphp -i | grep “mcrypt”# Output/etc/php/7.4/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 These are the steps required to install the MCrypt extension on most recent versions of PHP i.e. PHP 7.4. You can also refer How To Install MCrypt For PHP 7 On Ubuntu 18.04 LTS. How To Install PHP For Nginx On Ubuntu 20.04 LTS

What's Your Reaction?
Excited
0
Funny
0
In Love
0
Like It
0
Not Sure
0
0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Copyrights © 2021 Lucid.Hive.Systems. All Rights Reserved.

 

 

0
Would love your thoughts, please comment.x
()
x
lucid now GET LUCID NOW OFFICE