출처: https://zetawiki.com/wiki/CentOS_php-mcrypt_%EC%84%A4%EC%B9%98


Red Hat, CentOS 6에서 테스트하였습니다.
how to install php-mcrypt on CentOS 6
PHP Mcrypt on CentOS 6
The mcrypt extension is missing. Please check your PHP configuration.
php-mcrypt 설치

1 문제상황 1: phpMyAdmin[편집]

phpMyAdmin에서 아래와 같은 경고 메시지가 나온다.

The mcrypt extension is missing. Please check your PHP configuration.

php-mcrypt 모듈이 없어서 그렇다.

2 문제상황 2: php[편집]

PHP에서 mcrypt 함수를 사용하고 싶은데 안된다.

Fatal error: Call to undefined function mcrypt_create_iv()

3 확인[편집]

[root@zetawiki ~]# php -r "mcrypt_create_iv();"
PHP Fatal error:  Call to undefined function mcrypt_create_iv() in Command line code on line 1

Fatal error: Call to undefined function mcrypt_create_iv() in Command line code on line 1
→ mcrypt_create_iv 함수를 인식하지 못한다.
[root@zetawiki ~]# php -m | grep mcrypt
[root@zetawiki ~]# rpm -qa | grep mcrypt
[root@zetawiki ~]#
→ 설치 안됨.
[root@zetawiki ~]# yum list php-mcrypt
... (생략)
Error: No matching Packages to list
→ CentOS 기본 yum 저장소에는 없음

4 epel-release 설치[편집]

16px-Crystal_Clear_app_xmag.svg.png epel-release 설치 문서를 참고하십시오.

5 php-mcypt 설치[편집]

[root@zetawiki ~]# yum install php-mcrypt
... (생략)
==================================================================================================================
 Package                      Arch                     Version                       Repository              Size
==================================================================================================================
Installing:
 php-mcrypt                   x86_64                   5.3.3-1.el6                   epel                    18 k
Installing for dependencies:
 libmcrypt                    x86_64                   2.5.8-9.el6                   epel                    96 k

Transaction Summary
==================================================================================================================
Install       2 Package(s)

Total download size: 114 k
Installed size: 326 k
Is this ok [y/N]: y
... (생략)
Installed:
  php-mcrypt.x86_64 0:5.3.3-1.el6                                                                                 

Dependency Installed:
  libmcrypt.x86_64 0:2.5.8-9.el6                                                                                  

Complete!

6 확인 2[편집]

[root@zetawiki ~]# php -m | grep mcrypt
mcrypt
[root@zetawiki ~]# rpm -qa | grep mcrypt
php-mcrypt-5.3.3-1.el6.x86_64
libmcrypt-2.5.8-9.el6.x86_64
[root@zetawiki ~]# php -r "mcrypt_create_iv();"
PHP Warning:  mcrypt_create_iv() expects at least 1 parameter, 0 given in Command line code on line 1

Warning: mcrypt_create_iv() expects at least 1 parameter, 0 given in Command line code on line 1
→ mcrypt_create_iv 함수가 인식되었다.

7 아파치 재시작[편집]

  • 웹에도 적용되게 하기 위해서는 httpd를 재시작해야 한다.
[root@zetawiki ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
  • 이제 phpMyAdmin에서도 경고 메시지가 사라졌을 것이다.

8 같이 보기[편집]

9 참고[편집]


+ Recent posts