Installing mcrypt on php7.2: Difference between revisions
m added Category:DevOps using HotCat |
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight" Tags: Mobile edit Mobile web edit |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
< | So, you're running PHP7.2 but [https://liorkaplan.wordpress.com/2017/09/10/php-7-2-is-coming-mcrypt-extension-isnt/ can't install php7.2-mcrypt like you used to]? | ||
<syntaxhighlight lang="bash"> | |||
# install dependencies | # install dependencies | ||
sudo apt-get -y install gcc make autoconf libc-dev pkg-config | sudo apt-get -y install gcc make autoconf libc-dev pkg-config | ||
| Line 6: | Line 8: | ||
# use PECL to install mcrypt | # use PECL to install mcrypt | ||
sudo pecl install mcrypt-1.0.1 | sudo pecl install mcrypt-1.0.1 | ||
</ | </syntaxhighlight> | ||
Since PECL is ancient now, it doesn't actually enable the extension once it's built (unless you have PECL configured so that it knows where your php.ini file is). You'll know that you need to do more if PECL tells you: | Since PECL is ancient now, it doesn't actually enable the extension once it's built (unless you have PECL configured so that it knows where your php.ini file is). You'll know that you need to do more if PECL tells you: | ||
| Line 16: | Line 18: | ||
</blockquote> | </blockquote> | ||
Or, simply ask php: < | Or, simply ask php: <syntaxhighlight lang="bash">php -m</syntaxhighlight> If there is no 'mcrypt' in the output, PHP doesn't know that it's installed. | ||
Although you can add the required line into php.ini; on Ubuntu/Debian you will find module-specific <tt>*.ini</tt> files in <tt>/etc/php/7.2/mods-available/</tt> Just copy one to 'mcrypt.ini', and change the contents so that it contains | Although you can add the required line into php.ini; on Ubuntu/Debian you will find module-specific <tt>*.ini</tt> files in <tt>/etc/php/7.2/mods-available/</tt> Just copy one to 'mcrypt.ini', and change the contents so that it contains | ||
| Line 25: | Line 27: | ||
Once that's done, tell PHP about it: | Once that's done, tell PHP about it: | ||
< | <syntaxhighlight lang="bash"> | ||
sudo phpenmod mcrypt | sudo phpenmod mcrypt | ||
# confirm with | # confirm with | ||
php -m | grep mcrypt | php -m | grep mcrypt | ||
</ | </syntaxhighlight> | ||
Now, tell Apache to use your new PHP module: | Now, tell Apache to use your new PHP module: | ||
< | <syntaxhighlight lang="bash"> | ||
sudo systemctl reload apache2 | sudo systemctl reload apache2 | ||
# confirm with | # confirm with | ||
php -i | grep mcrypt | php -i | grep mcrypt | ||
</ | </syntaxhighlight> | ||
[[Category:PHP]] | [[Category:PHP]] | ||
[[Category:Development]] | [[Category:Development]] | ||
[[Category:DevOps]] | [[Category:DevOps]] | ||