1
2

More than 3 years have passed since last update.

php-mcryptをphp7.2以降でとりあえず使う

Posted at

PHPの暗号化モジュールphp-mcryptが、PHP7.1で非推奨に/php7.2では削除されました。
opensslやsodiumへの移行が推奨されていますが、ひとまずpeclに移動したphp-mcryptを使う方法をまとめます。

今回はphp-7.4でpeclのphp-mcryptを組み込みます。

[prompt] # yum install -y --enablerepo=remi,amzn2extra-php7.4 php74-php-pecl-mcrypt

モジュールの位置を確認

[prompt] # find / -name "mcrypt.so"
/opt/remi/php74/root/usr/lib64/php/modules/mcrypt.so

モジュールファイルを組込む設定ファイルを作成します。

[prompt] # vim /etc/php.d/mcrypt.ini
--
extension=/opt/remi/php74/root/usr/lib64/php/modules/mcrypt.so 

これでphp-mcryptが有効になりました。

[prompt] # php -i | grep "mcrypt support"
mcrypt support => enabled
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2