-
Star
(115)
You must be signed in to star a gist -
Fork
(78)
You must be signed in to fork a gist
-
-
Save arzzen/1209aa4a430bd95db3090a3399e6c35f to your computer and use it in GitHub Desktop.
## | |
## How to install mcrypt in php7.2 / php7.3 | |
## Linux / MacOS / OSX | |
## | |
## https://lukasmestan.com/install-mcrypt-extension-in-php7-2/ | |
# | |
# Check version php and pecl | |
# | |
php -v # if default php is not 7.2 then use /usr/bin/php7.2 instead php | |
pecl version | |
sudo apt-get install php-pear | |
sudo apt-get install php7.2-dev | |
# | |
# Install mcrypt extension | |
# see http://pecl.php.net/package-info.php?package=mcrypt&version=1.0.1 | |
# | |
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 trought 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 | |
# | |
# Grab installing path and add to cli and apache2 php.ini | |
# | |
# example: | |
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" | |
# check that the extension was installed with this command: | |
php -i | grep mcrypt | |
# | |
# The output will look like this: | |
# | |
# /etc/php/7.2/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 | |
# final step | |
sudo service apache2 restart |
Thanks, It's working fine.
Muito bom !
Any solution windows servers?
Saved my day!
Thank you .
Its works :)
thanks, it works
Thank's it solved my problem...
Worked for me also many thanks 👍
After trying to many things. I just got rid of this shit by installing both version on my computer.
First I installed php 7.1.19 version.
Secondly I installed php 7.2.15 version
Now I am working perfectly with my project.
yup its work....!!!
Thanks! On my Devuan (Debian minus systemd) server, the only change I made was instead of
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"
I did
sudo bash -c "echo extension=/usr/lib/php/20170718/mcrypt.so > /etc/php/7.3/mods-available/mcrypt.ini"
sudo phpenmod mcrypt # (add symlinks in /etc/php/7.3/cli/conf.d/ and /etc/php/7.3/apache2/conf.d/)
For PHP 7.3 this is
sudo pecl install mcrypt-1.0.2
thank you very much , working perfect on ubuntu 18.04.2
Good one!
Thanks...its works...!!!
pecl install mcrypt-1.0.2
did you get it work on php 7.3 only?
i get phpize failed which forces me to install php 7.2 regarding this manual
For PHP 7.3 this is
sudo pecl install mcrypt-1.0.2
Thank's it works!
thanks, worked on my windows linux subsystem,
php 7.2 i believe on ubuntu.
It didn't work for me
PHP Warning: PHP Startup: mcrypt: Unable to initialize module
Module compiled with module API=20190902
PHP compiled with module API=20170718
These options need to match
in Unknown on line 0
It didn't work for me
PHP Warning: PHP Startup: mcrypt: Unable to initialize module
Module compiled with module API=20190902
PHP compiled with module API=20170718
These options need to match
in Unknown on line 0
you have multiple php versions installed, i see you are having trouble and running any commands you googled. I had a coworker who did the same thing. He figured out how to make his cli and normal php the same version and then got this working... please follow my next post
i'd remove everything then do the following:
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04
and then
https://lukasmestan.com/install-mcrypt-extension-in-php7-2/
when you get phpize error
Q: I see error message: ERROR: 'phpize' failed
A: install php7.2-dev with apt-get install php7.2-dev
@dave-lw, i installed it form source code (gist)
yeah the problem is with your php though, you have several versions installed and it is causing problems. I gave you the solution.
For Xampp you can look for the DLL links here: https://pecl.php.net/package/mcrypt
E.g. for my Xampp with PHP 7.3.12, I downloaded 7.3 Thread Safe (TS) x64 from here: https://pecl.php.net/package/mcrypt/1.0.3/windows
I dropped the DLL in C:\xampp_7.3.12\php\ext\
, and added the line extension=php_mcrypt.dll
to php.ini
Reminder: you are not supposed to use mcrypt in production.
You saved my day
For PHP 7.3 this is
sudo pecl install mcrypt-1.0.2
How to confirm mcrypt is insalled ?
php -m
lists your active modules.
For Windows Users
- Check in your PHP Info if your PHP is 32bit (x86) or 64bit (x64)
- Now visit: https://pecl.php.net/package/mcrypt/1.0.3/windows and download the appropriate version for your PHP's version and the architecture.
- Again in your PHP info page, search for var: extension_dir and open the directory.
- Unzip the file you downloaded from the above url.
- Open your XAMPP's or MAMP's php.ini file. In case you don't know where is it, you can find it from your php info page again:
- Inside the php.ini file, find where the extensions are loaded. It should be lines like: extension=php_curl.dll etc.
- Add a new line: extension=php_mcrypt.dll and save the file changes.
- Now restart XAMPP/MAMPP or apache in general.
It's ready!
Thanks bro!. Worked awesome.