메뉴 건너뛰기

조회 수 7663 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

CentOS 7 에 php 설치하기 (디비와 아파치를 설치한후 마지막에 php를 설치한다.)

 

 

설치 가능한 php 버전을 확인해 본다.

확인해 보니 버전이 php 5.4.16 이다. 

[root@localhost ~]# yum list | grep php

graphviz-php.x86_64                     2.30.1-18.el7                  base     

php.x86_64                              5.4.16-23.el7_0.3              updates  

php-bcmath.x86_64                       5.4.16-23.el7_0.3              updates  

php-cli.x86_64                          5.4.16-23.el7_0.3              updates  

php-common.x86_64                       5.4.16-23.el7_0.3              updates  

php-dba.x86_64                          5.4.16-23.el7_0.3              updates  

php-devel.x86_64                        5.4.16-23.el7_0.3              updates  

php-embedded.x86_64                     5.4.16-23.el7_0.3              updates  

php-enchant.x86_64                      5.4.16-23.el7_0.3              updates  

php-fpm.x86_64                          5.4.16-23.el7_0.3              updates  

php-gd.x86_64                           5.4.16-23.el7_0.3              updates  

php-intl.x86_64                         5.4.16-23.el7_0.3              updates  

php-ldap.x86_64                         5.4.16-23.el7_0.3              updates  

php-mbstring.x86_64                     5.4.16-23.el7_0.3              updates  

php-mysql.x86_64                        5.4.16-23.el7_0.3              updates  

php-mysqlnd.x86_64                      5.4.16-23.el7_0.3              updates  

php-odbc.x86_64                         5.4.16-23.el7_0.3              updates  

php-pdo.x86_64                          5.4.16-23.el7_0.3              updates  

php-pear.noarch                         1:1.9.4-21.el7                 base     

php-pecl-memcache.x86_64                3.0.8-4.el7                    base     

php-pgsql.x86_64                        5.4.16-23.el7_0.3              updates  

php-process.x86_64                      5.4.16-23.el7_0.3              updates  

php-pspell.x86_64                       5.4.16-23.el7_0.3              updates  

php-recode.x86_64                       5.4.16-23.el7_0.3              updates  

php-snmp.x86_64                         5.4.16-23.el7_0.3              updates  

php-soap.x86_64                         5.4.16-23.el7_0.3              updates  

php-xml.x86_64                          5.4.16-23.el7_0.3              updates  

php-xmlrpc.x86_64                       5.4.16-23.el7_0.3              updates  

rrdtool-php.x86_64                      1.4.8-8.el7                    base     

uuid-php.x86_64                         1.6.2-26.el7                   base     

 

 

php를 설치한다.

중간에 y를 선택해 준다. 연관 패키지이다.

 

[root@localhost ~]# yum install php php-mysql php-gd php-pear

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

 * base: centos.tt.co.kr

 * extras: centos.tt.co.kr

 * updates: centos.tt.co.kr

Resolving Dependencies

--> Running transaction check

---> Package php.x86_64 0:5.4.16-23.el7_0.3 will be installed

--> Processing Dependency: php-common(x86-64) = 5.4.16-23.el7_0.3 for package: php-5.4.16-23.el7_0.3.x86_64

--> Processing Dependency: php-cli(x86-64) = 5.4.16-23.el7_0.3 for package: php-5.4.16-23.el7_0.3.x86_64

---> Package php-gd.x86_64 0:5.4.16-23.el7_0.3 will be installed

--> Processing Dependency: libt1.so.5()(64bit) for package: php-gd-5.4.16-23.el7_0.3.x86_64

---> Package php-mysql.x86_64 0:5.4.16-23.el7_0.3 will be installed

--> Processing Dependency: php-pdo(x86-64) = 5.4.16-23.el7_0.3 for package: php-mysql-5.4.16-23.el7_0.3.x86_64

---> Package php-pear.noarch 1:1.9.4-21.el7 will be installed

--> Processing Dependency: php-xml for package: 1:php-pear-1.9.4-21.el7.noarch

--> Processing Dependency: php-posix for package: 1:php-pear-1.9.4-21.el7.noarch

--> Running transaction check

---> Package php-cli.x86_64 0:5.4.16-23.el7_0.3 will be installed

---> Package php-common.x86_64 0:5.4.16-23.el7_0.3 will be installed

--> Processing Dependency: libzip.so.2()(64bit) for package: php-common-5.4.16-23.el7_0.3.x86_64

---> Package php-pdo.x86_64 0:5.4.16-23.el7_0.3 will be installed

---> Package php-process.x86_64 0:5.4.16-23.el7_0.3 will be installed

---> Package php-xml.x86_64 0:5.4.16-23.el7_0.3 will be installed

---> Package t1lib.x86_64 0:5.1.2-14.el7 will be installed

--> Running transaction check

---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================

 Package            Arch          Version                  Repository      Size

================================================================================

Installing:

 php                x86_64        5.4.16-23.el7_0.3        updates        1.3 M

 php-gd             x86_64        5.4.16-23.el7_0.3        updates        124 k

 php-mysql          x86_64        5.4.16-23.el7_0.3        updates         97 k

 php-pear           noarch        1:1.9.4-21.el7           base           357 k

Installing for dependencies:

 libzip             x86_64        0.10.1-8.el7             base            48 k

 php-cli            x86_64        5.4.16-23.el7_0.3        updates        2.7 M

 php-common         x86_64        5.4.16-23.el7_0.3        updates        561 k

 php-pdo            x86_64        5.4.16-23.el7_0.3        updates         95 k

 php-process        x86_64        5.4.16-23.el7_0.3        updates         52 k

 php-xml            x86_64        5.4.16-23.el7_0.3        updates        122 k

 t1lib              x86_64        5.1.2-14.el7             base           166 k

 

Transaction Summary

================================================================================

Install  4 Packages (+7 Dependent packages)

 

Total download size: 5.7 M

Installed size: 21 M

Is this ok [y/d/N]: y

Downloading packages:

(1/11): libzip-0.10.1-8.el7.x86_64.rpm                     |  48 kB   00:00     

(2/11): php-5.4.16-23.el7_0.3.x86_64.rpm                   | 1.3 MB   00:01     

(3/11): php-gd-5.4.16-23.el7_0.3.x86_64.rpm                | 124 kB   00:01     

(4/11): php-pdo-5.4.16-23.el7_0.3.x86_64.rpm               |  95 kB   00:00     

(5/11): php-common-5.4.16-23.el7_0.3.x86_64.rpm            | 561 kB   00:01     

(6/11): php-process-5.4.16-23.el7_0.3.x86_64.rpm           |  52 kB   00:00     

(7/11): php-xml-5.4.16-23.el7_0.3.x86_64.rpm               | 122 kB   00:00     

(8/11): php-mysql-5.4.16-23.el7_0.3.x86_64.rpm             |  97 kB   00:00     

(9/11): php-pear-1.9.4-21.el7.noarch.rpm                   | 357 kB   00:00     

(10/11): php-cli-5.4.16-23.el7_0.3.x86_64.rpm              | 2.7 MB   00:01     

(11/11): t1lib-5.1.2-14.el7.x86_64.rpm                     | 166 kB   00:00     

--------------------------------------------------------------------------------

Total                                              2.7 MB/s | 5.7 MB  00:02     

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Installing : libzip-0.10.1-8.el7.x86_64                                  1/11 

  Installing : php-common-5.4.16-23.el7_0.3.x86_64                         2/11 

  Installing : php-cli-5.4.16-23.el7_0.3.x86_64                            3/11 

  Installing : php-pdo-5.4.16-23.el7_0.3.x86_64                            4/11 

  Installing : php-process-5.4.16-23.el7_0.3.x86_64                        5/11 

  Installing : php-xml-5.4.16-23.el7_0.3.x86_64                            6/11 

  Installing : t1lib-5.1.2-14.el7.x86_64                                   7/11 

  Installing : php-gd-5.4.16-23.el7_0.3.x86_64                             8/11 

  Installing : 1:php-pear-1.9.4-21.el7.noarch                              9/11 

  Installing : php-mysql-5.4.16-23.el7_0.3.x86_64                         10/11 

  Installing : php-5.4.16-23.el7_0.3.x86_64                               11/11 

  Verifying  : php-common-5.4.16-23.el7_0.3.x86_64                         1/11 

  Verifying  : php-pdo-5.4.16-23.el7_0.3.x86_64                            2/11 

  Verifying  : t1lib-5.1.2-14.el7.x86_64                                   3/11 

  Verifying  : php-process-5.4.16-23.el7_0.3.x86_64                        4/11 

  Verifying  : php-5.4.16-23.el7_0.3.x86_64                                5/11 

  Verifying  : php-gd-5.4.16-23.el7_0.3.x86_64                             6/11 

  Verifying  : php-xml-5.4.16-23.el7_0.3.x86_64                            7/11 

  Verifying  : php-mysql-5.4.16-23.el7_0.3.x86_64                          8/11 

  Verifying  : php-cli-5.4.16-23.el7_0.3.x86_64                            9/11 

  Verifying  : libzip-0.10.1-8.el7.x86_64                                 10/11 

  Verifying  : 1:php-pear-1.9.4-21.el7.noarch                             11/11 

 

Installed:

  php.x86_64 0:5.4.16-23.el7_0.3           php-gd.x86_64 0:5.4.16-23.el7_0.3    

  php-mysql.x86_64 0:5.4.16-23.el7_0.3     php-pear.noarch 1:1.9.4-21.el7       

 

Dependency Installed:

  libzip.x86_64 0:0.10.1-8.el7             php-cli.x86_64 0:5.4.16-23.el7_0.3  

  php-common.x86_64 0:5.4.16-23.el7_0.3    php-pdo.x86_64 0:5.4.16-23.el7_0.3  

  php-process.x86_64 0:5.4.16-23.el7_0.3   php-xml.x86_64 0:5.4.16-23.el7_0.3  

  t1lib.x86_64 0:5.1.2-14.el7             

 

Complete!

설치가 완료 되었다.

 

 

아파치를 재시작해 준다.

[root@localhost ~]# systemctl restart httpd.service

 

 

홈페이지에서 php 정보를 확인하기 위해 info.php 파일을 만든다.

[root@localhost ~]# vi /var/www/html/info.php

내용은 아래와 같이 입력한다.

<?php

   phpinfo();

?>

참고로 저장하고 빠져 나올때는 ESC 키를 누른 후에 손을 땐후

:wq

입력하면 저장후 빠져 나온다.

 

아파치를 재시작해 준다.

[root@localhost ~]# systemctl restart httpd.service

 

 

CentOS에 깔려 있는 브라우저 파이어 폭스를 실행해서 php 정보를 확인해 본다.

주소창에 입력

localhost/info.php

 

참고사항

PHP 설치 경로 : /usr/lib64/php

PHP 설정파일 경로 :  /etc/php.ini


List of Articles
번호 제목 날짜 조회 수
137 webmin 설치하기 file 2014.02.27 8712
136 vsftp 이란? 2014.02.27 9258
135 user 계정관리 (useradd, userdel, groupadd, groupdel, usermod etc..) file 2017.11.22 5312
134 URL 포워딩 하는 방법 2014.02.27 6958
133 TOMCAT/사이트 여러개 운영 2017.03.09 8444
132 Tomcat 6에 Datasource 설정하기 2017.03.11 7624
131 tomcat - server.xml 설정 file 2017.03.11 67354
130 tmp 보안 셋팅 2014.02.27 7086
129 telnet 설정하기 2014.02.27 7021
128 tar.gz 파일 묶기, 압축하기, 압축 풀기 2021.03.26 407
127 suPHP로 웹서버 보안을 강화하자 2014.02.27 8781
126 sulinux2.0 NFS 설정 & 공유 2015.06.10 7943
125 ssh에서 sftp 사용 막기 2014.02.27 7494
124 ssh timeout 설정 2014.02.27 7726
123 SSH / FTP 등 기본 접속환경 설정(리눅스 / 솔라리스) 2017.02.03 7827
122 SQL 인젝션 복구 쿼리 2014.02.27 8248
121 split 명령어 (파일 나누기) 2021.03.26 76656
120 Snort란 2014.02.27 7873
119 sendmail 587 포트 사용 2014.03.26 7728
118 SAMBA 설치 2014.02.27 7315
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 12 Next
/ 12

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved