- Newest
- Most votes
- Most comments
php-mcrypt requires libmcrypt and libmcrypt-devel
As per [Package Request] - libmcrypt, libmcrypt-devel #403 , AL2023 will not include them. This is also mentioned at Functionality deprecated in AL2 and removed in AL2023
The mcrypt library and associated PHP extension was deprecated in AL2, and is no longer present in AL2023.
Upstream PHP deprecated the mcrypt extension in PHP 7.1 which was first released in December 2016 and had its final release in October 2019.
The upstream mcrypt library last made a release in 2007 , and has not made the migration from cvs revision control that SourceForge required for new commits in 2017, with the most recent commit (and only for 3 years prior) being from 2011 removing the mention of the project having a maintainer.
Any remaining users of mcrypt are advised to port their code to OpenSSL, as mcrypt will not be added to AL2023. `
You will need to get libmcrypt from other sources and use pecl to compile.
This may work for you.
Create /etc/yum.repos.d/fedora.repo file with the following content. I am using Fedora 36 as AL2023 is based in part on it
[fedora]
name=Fedora 36 - $basearch
#baseurl=http://download.example/pub/fedora/linux/releases/36/Everything/$basearch/os/
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-36&arch=$basearch
enabled=1
countme=1
metadata_expire=7d
repo_gpgcheck=0
type=rpm
gpgcheck=0
gpgkey=https://getfedora.org/static/fedora.gpg
skip_if_unavailable=False
Install the mcrypt libaries from Fedora repo
sudo dnf clean all
sudo dnf install libmcrypt-devel libmcrypt -y
Disable Fedora repo
sudo dnf config-manager --disable fedora
sudo dnf clean all
To use pecl to compile php-mcrypt,
sudo dnf install -y php-devel php-pear gcc
sudo pecl update-channels
sudo pear config-set php_ini /etc/php.ini
sudo pecl install mcrypt
This is the phpinfo() output from my AL2023
I had posted the following yesterday, before I saw the latest response. But I must have missed a step here, because my response (from yesterday) does not appear.
Here was my response: Update: After updating the fedora version in fedora.repo (to 38, 39, 40) - without success, I removed (renamed) fedora.repo and was able to successfully run "dnf -y php-devel" which appeared to be the main stumbling block. Also php-pear and gcc.
Then after the two pecl commands, it seemed to work.
[I was not able to reconcile the php extension versions with what was sourced from the fedora versions].
Thanks for your help.
Great to know you resolved it. Thanks for the status update!
- First, update your package repository and install any available updates.
sudo yum update -y
- Install necessary development tools and libraries.
sudo yum groupinstall -y "Development Tools"
sudo yum install -y php php-devel php-pear libmcrypt libmcrypt-devel
- The Extra Packages for Enterprise Linux (EPEL) repository contains additional packages that are not included in the default repositories.
sudo amazon-linux-extras install epel -y
- If PHP 8.2 is not already installed, install it using the Amazon Linux Extras repository.
sudo amazon-linux-extras enable php8.2
sudo yum clean metadata
sudo yum install -y php php-cli php-common php-devel php-pear
- Install PECL. PECL (PHP Extension Community Library) is used to install PHP extensions.
sudo yum install -y php-pear
- Use PECL to install the mcrypt extension. Specify the version you need (1.0.6 or 1.0.7).
sudo pecl install mcrypt-1.0.6
Alternatively, for version 1.0.7, use:
sudo pecl install mcrypt-1.0.7
- Enable the mcrypt Extension. After installing mcrypt, you need to enable it in your PHP configuration.
echo "extension=mcrypt.so" | sudo tee /etc/php.d/20-mcrypt.ini
- Restart your web server to apply the changes. If you are using Apache, use the following command:
sudo systemctl restart httpd
If you are using Nginx with PHP-FPM, use:
sudo systemctl restart php-fpm
sudo systemctl restart nginx
9.Verify Installation. To verify that mcrypt is installed and enabled, create a PHP info file or use the CLI to check.
php -m | grep mcrypt
Alternatively, create a phpinfo.php file in your web server's root directory with the following content:
<?php phpinfo(); ?>
Access this file via your web browser and search for "mcrypt" in the output to ensure it is enabled.
"amazon-linux-extras" is not available on Amazon Linux 2023. https://repost.aws/questions/QUWGU3VFJMRSGf6MDPWn4tLg/how-to-resolve-amazon-linux-extras-in-al2023
Relevant content
- asked 7 years ago
- asked 2 years ago

I get an error at this point:
I see from https://mirrormanager.fedoraproject.org/ that fedora 41 may be the latest, but I am not sure how to proceed. Is there a way to reverse the fedora.repo installation and start again?
My apologies for missing out the step to disable Fedora repo. I have updated my post. I suggest you try Fedora 36 first as above since AL2023 includes components from Fedora 34 to 36.