Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install mcrypt on PHP 7.3.3 ubuntu

Tags:

php

mcrypt

pecl

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

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
sudo pecl install mcrypt-1.0.1

I get:

pecl/mcrypt requires PHP (version >= 7.2.0, version <= 7.3.0, excluded versions: 7.3.0), installed version is 7.3.3-1+ubuntu14.04.1+deb.sury.org+1
No valid packages found
install failed

I use prestashop which require this

like image 929
Elia Weiss Avatar asked Apr 14 '19 17:04

Elia Weiss


People also ask

How do I enable PHP mcrypt?

You can install Mcrypt from the PHP Source Tree as a module if you choose. Enable the module by adding: 'extension=mcrypt.so' to PHP. ini. Done!

How install mcrypt in Linux?

Installation of php-mcryptini file using nano editor. Now edit the php. ini file and under Dynamic extension, type: extension=mcrypt.so beside other extensions, as shown in the screenshot. Save the file ctrl+X, type Y, and hit the Enter key.

How do I know if PHP mcrypt is installed?

Determine if the mcrypt extension is loaded in any of the following ways: Set up a phpinfo. php file in the web server's root directory and examine the output in a web browser. Run the following command: $ php -r "phpinfo();" | grep mcrypt.

What is PHP mcrypt package?

What is mcrypt? The mcrypt extension is a replacement for the UNIX crypt command. These commands serve as a means to encrypt files on UNIX and Linux systems. The php-mcrypt extension serves as an interface between PHP and mcrypt.


1 Answers

If anyone is using an AWS bitnami install w/ php7.3.10, the following is a layout with appropriate file paths (references listed below)

Check your PHP version

$ php -version

Install mcrypt extension

$ sudo apt-get -y install gcc make autoconf libc-dev pkg-config
$ sudo apt-get -y install libmcrypt-dev

If php version > 7.3.0

$ sudo pecl install mcrypt-1.0.2

Or the newest version: https://pecl.php.net/package/mcrypt

If php version <= 7.3.0

$ sudo pecl install mcrypt-1.0.1

When you are shown the prompt (Press [Enter] to autodetect)

> libmcrypt prefix? [autodetect] :

enable mcrypt in php.ini -> check if mcrypt is already in php.ini and maybe just needs to be uncommented

$ more /opt/bitnami/php/etc/php.ini | grep mcrypt
;extension=mcrypt.so

Add or uncomment extension=mcrypt.so in php.ini

$ emacs /opt/bitnami/php/etc/php.ini

REFERENCES...

https://lukasmestan.com/install-mcrypt-extension-in-php7-2/

How to install mcrypt on PHP 7.3.3 ubuntu

https://stackoverflow.com/a/55678046/2298002

like image 194
greenhouse Avatar answered Oct 27 '22 08:10

greenhouse