Difference between revisions of "Installing mcrypt on php7.2"

From Freephile Wiki
Jump to navigation Jump to search
(drafting)
 
Line 5: Line 5:
 
sudo apt-get -y install libmcrypt-dev
 
sudo apt-get -y install libmcrypt-dev
 
# use PECL to install mcrypt
 
# use PECL to install mcrypt
 
 
sudo pecl install mcrypt-1.0.1
 
sudo pecl install mcrypt-1.0.1
 
</source>
 
</source>
  
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:
  
 
<blockquote>
 
<blockquote>
 
 
configuration option "php_ini" is not set to php.ini location
 
configuration option "php_ini" is not set to php.ini location
  
 
You should add "extension=mcrypt.so" to php.ini
 
You should add "extension=mcrypt.so" to php.ini
 
 
</blockquote>
 
</blockquote>
  
Or, simply ask php: <source lang="bash">php  -m</source>  If there's no 'mcrypt' in the output, PHP doesn't know that it's installed.   
+
Or, simply ask php: <source lang="bash">php  -m</source>  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
  
 
<blockquote>
 
<blockquote>
 +
extension=mcrypt.so
 +
</blockquote>
  
extension=mcrypt.so
+
Once that's done, tell PHP about it:
 +
<source lang="bash">
 +
sudo phpenmod mcrypt
 +
# confirm with
 +
php -m | grep mcrypt
 +
</source>
 +
 
 +
Now, tell Apache to use your new PHP module:
 +
<source lang="bash">
 +
sudo systemctl reload apache2
 +
# confirm with
 +
 
 +
php -i | grep mcrypt
 +
</source>
  
</blockquote>
+
[[Category:PHP]]

Revision as of 10:30, 18 October 2018

# install dependencies
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
# use PECL to install mcrypt
sudo pecl install mcrypt-1.0.1

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:

configuration option "php_ini" is not set to php.ini location

You should add "extension=mcrypt.so" to php.ini

Or, simply ask php:

php  -m

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 *.ini files in /etc/php/7.2/mods-available/ Just copy one to 'mcrypt.ini', and change the contents so that it contains

extension=mcrypt.so

Once that's done, tell PHP about it:

sudo phpenmod mcrypt
# confirm with 
php -m | grep mcrypt

Now, tell Apache to use your new PHP module:

sudo systemctl reload apache2
# confirm with 

php -i | grep mcrypt