CentOS php-mysql 설치

(Fatal error: Class 'mysqli' not found에서 넘어옴)
  다른 뜻에 대해서는 우분투 php-mysql 설치 문서를 참조하십시오.
Fatal error: Class 'mysqli' not found
php-mysql 설치

1 문제상황[ | ]

[root@zetawiki ~]# php -r 'new mysqli();'
PHP Fatal error:  Class 'mysqli' not found in Command line code on line 1

2 원인[ | ]

[root@zetawiki ~]# php -m | grep mysqli
[root@zetawiki ~]# rpm -qa | grep php-mysql
→ php-mysql 패키지가 제공하는 mysqli 모듈이 없음

3 해결방법[ | ]

  • php-mysql 설치
[root@zetawiki ~]# yum install php-mysql
... (생략)
=============================================================================================
 Package               Arch              Version                    Repository          Size
=============================================================================================
Installing:
 php-mysql             x86_64            5.3.3-40.el6_6             updates             84 k
Installing for dependencies:
 mysql-libs            x86_64            5.1.73-3.el6_5             base               1.2 M
 php-pdo               x86_64            5.3.3-40.el6_6             updates             78 k

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

Total download size: 1.4 M
Installed size: 4.4 M
Is this ok [y/N]: y
... (생략)
Installed:
  php-mysql.x86_64 0:5.3.3-40.el6_6                                                          

Dependency Installed:
  mysql-libs.x86_64 0:5.1.73-3.el6_5             php-pdo.x86_64 0:5.3.3-40.el6_6            

Complete!

4 확인[ | ]

[root@zetawiki ~]# rpm -qa | grep php-mysql
php-mysql-5.3.3-40.el6_6.x86_64
[root@zetawiki ~]# php -m | grep mysqli
mysqli
[root@zetawiki ~]# php -r 'new mysqli();'
[root@zetawiki ~]#
→ 오류 없이 실행됨

5 같이 보기[ | ]

6 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}