WARNING: Module mcrypt ini file doesn't exist, but is in installed - php

I run Ubuntu 16.04 and am trying to install mcrypt.
I can see it in my info.php.
I have followed this steps:
1. Install php7.0-mcrypt
sudo apt install php7.0-mcrypt
2.Create symbolic link to php7.0-mcrypt
sudo ln -s /etc/php/7.0/mods-available/mcrypt.ini /etc/php/7.0/mods-available/
3.Enable mcrypt extension
sudo phpenmod mcrypt
And when I enable I get this:
WARNING: Module mcrypt ini file doesn't exist under /etc/php/7.2/mods-available
WARNING: Module mcrypt ini file doesn't exist under /etc/php/7.2/mods-available
But I don't use 7.2, I use 7.0 and I have the mcrypt ini file in /etc/php/7.0/mods-available.

The warning reports PHP version 7.2, so that's what is apparently running.
Are you sure you are running PHP-7.0? What does php -v returns?
I suspect you have multiple version of PHP installed on the system.
Try to run sudo update-alternatives --config php and choose the version that you want to work on.
That should fix it.

Related

Cannot install mcrypt with homebrew and php7.4

OS: macOS 11 (big sur)
Homebrew: 2.5.12
PEAR Version: 1.10.12
I just upgraded the php on my mac from php7.1 to php7.4 with homebrew (brew install php#7.4).
Then, when I try to install mcrypt extension, I got the error:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
ERROR: `/private/tmp/pear/install/mcrypt/configure --with-php-config=/usr/local/homebrew/opt/php#7.4/bin/php-config --with-mcrypt' failed
Here is what I did:
brew isntall mcrypt
install the pecl
sudo pecl install mcrypt -- The error goes here.
What I tried:
Located the mcrypt.h and put manually the file to the several locations (based on the php-config), not work.
Cleaned the brew and reinstall/relink the mcrypt(libmcrypt), not work.
Removed the legacy mcrypt files of the old brew version.
I ran into the same problem. So after installing libmcrypt with brew install mcrypt it seems like configure is not able to resolve the path to mcrypt.h automatically. It also does not work to specify the CPPFLAGS or giving the homebrew include path.
But I found a solution that works for me by giving pecl the install location of mcrypt in the Homebrew Cellar. This is what the following code does automatically:
pecl install mcrypt <<<"$(ls -d $(brew --prefix)/Cellar/mcrypt/* | tail -1)"
if you using brew try this :
1.Unistall existing php then Install shivammathur/php
add shivammathur php
brew tap shivammathur/php
change php version with you needed (5.6 or 7.2 or 7.4 or 8.1 or next version)
brew install shivammathur/php/php#7.4
2.Install shivammathur/extensions it s will add extension to php
then
brew tap shivammathur/extensions
brew install shivammathur/extensions/mcrypt#7.4
then you install mcrypt with same version as php version
brew install mcrypt#7.4
then restart httpd
brew services restart httpd
Ref :
https://github.com/shivammathur/homebrew-php
https://github.com/shivammathur/homebrew-extensions
The problem here is the configure command can't find the libmcrypt installed by homebrew
You can
Download the source code of mcrypt-1.0.4, then cd in the folder
run "phpize"
run "./configure --with-mcrypt=/opt/homebrew/Cellar/mcrypt/2.6.8", you can change the path here with your path for homebrew lib
run "make && make install"
add extension=mcrypt.so to your config file
ps: Use php -i | grep "Loaded Configuration File" to locate your php configure file
in case of an error on macOS use the complete path in php.ini like:
extension="/opt/homebrew/Cellar/php/8.1.9/pecl/20210902/mcrypt.so"

I am getting "Mcrypt PHP extension required" when I type php artisan serve in my terminal

I have created a project in laravel but when I try to run it with php artisan serve I get this error: Mcrypt PHP extension required. I need some help
enable mcrypt extension on php.ini file
Go to your php.ini file ebanle mycrypt extension. Check if mycrypt is present in your extension directory.
if not found then download mycrpyt from https://pecl.php.net/ (Windows)
on Linux
$ sudo apt install php-dev libmcrypt-dev php-pear
$ sudo pecl channel-update pecl.php.net
$ sudo pecl install mcrypt-1.0.1

WARNING: Module mcrypt ini file doesn't exist under /etc/php/7.2/mods-available

I've been trying to install phpmyadmin in Ubuntu 16.04.3 LTS having a lamp installed, php 7.2, mysql Ver 15.1 Distrib 10.2.12-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2 and apache2.
and I am following this article from digitalOcean, but when I came to the part that I need to run sudo phpenmod mcrypt I got a message saying..
WARNING: Module mcrypt ini file doesn't
exist under /etc/php/7.2/mods-available
I am doing this on ubuntu installed in godaddy
Can you give best solution for this?
Pointing to php7.1-mcrypt with php7.2 will solve the issue here. Below are the steps to configure 7.1 version mcrypt with php7.2
Install php7.1-mcrypt
sudo apt install php7.1-mcrypt
Create symbolic link to php7.1-mcrypt
sudo ln -s /etc/php/7.1/mods-available/mcrypt.ini /etc/php/7.2/mods-available/
Enable mcrypt extension
sudo phpenmod mcrypt
Restart the FastCGI Process Manager service
sudo service php7.2-fpm restart
Note:
The above solution is a workaround to enable mcrypt in php7.2 through apt till php7.2-mcrypt is not available.
for php-7.3 like mentioned above i had to execute this command
sudo ln -s /etc/php/7.0/mods-available/mcrypt.ini /etc/php/7.3/mods-available/
cause the version 7.0 comes by default.

install GNU PG (GPG) for php5.6 on ubuntu 16.04

I have 2 versions of php installed on my ubuntu php5.6 and php7. 5.6 is set as active version. Now I am trying to install GPG using below line of code, and it installs it under /etc/php/7.0 directory.
sudo apt-get install php-gnupg
How to install it for php5.6?
Extension dir for php 5.6 is /usr/lib/php/20131226 and extension dir for php 7.0 is /usr/lib/php/20151012 as this command shows:
php -r "print phpinfo();" | grep "extension_dir"
Pecl installs gnupg in /usr/lib/php/20131226/gnupg.so because the pecl was installed when php 5.6 is enabled
pecl list-files gnupg
Conclusion: PHP 7.0 uses a different extension directory than where the gnupg is installed.
First try which didn't work: Create symlink for gnup.so inside the php 7.0 extension directory that points to gnup.so inside php 5.6
sudo ln -s /usr/lib/php/20131226/gnupg.so /usr/lib/php/20151012/gnupg.so
Results in:
Warning: PHP Startup: gnupg: Unable to initialize module
Module compiled with module API=20131226
PHP compiled with module API=20151012
Second try which also didn't work:
Uninstall pecl extension: sudo pecl uninstall gnupg
Activate php v 7.0
Install gnupg again: sudo pecl install gnupg
Gives same compiling error.
Final solution:
Install a compiled version of the gnupg that works with php 7.0: see php docs here
Check if gnupg is installed
php -r 'var_dump(function_exists("gnupg_decrypt"));';

How do I install mcrypt for lampp in ubuntu 14.04 lts

I am new in php framework. So, I am trying to grasp the pros and cons of Laravel 4.2.11
But when I was going to install composer in the laravel's root folder in the htdocs folder of lampp, it showed warning in the terminal that it requires MCrypt PHP Extension.
By the way, I have another php installed in my PC in /usr/bin/php and its version is 5.5.9 and Lampp's php version is 5.6.12
phpinfo() of Lampp showed that It has mcrypt support and mcrypt_filter support, both are enabled.
What should I do to enable artisan to work for Lampp's php?
First ensure the mcrypt module is installed:
sudo apt-get install php5-mcrypt
Then:
sudo php5enmod mcrypt

Categories