메뉴 건너뛰기

조회 수 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
번호 제목 날짜 조회 수
157 웹서버 모니터링 툴 awststs 2014.03.26 10267
156 apache 컴파일시 동시 접속자 제한 변경하기 2014.03.26 8157
155 yum으로 phpmyadmin 설치 2014.03.26 7544
154 싱글모드 부팅 후, fstab read only 발생시 2014.03.26 8517
153 긴급 스왑 메모리 추가 하기 2014.03.26 7622
152 리눅스 한글 설정 2014.03.26 8244
151 iconv 추가 설치 2014.03.26 8603
150 apache vhost deny 설정 2014.03.26 7587
149 리눅스 서버 백업 - Crontab 2014.03.26 7619
148 Linux 시스템 백업과 복원 2014.03.26 7862
147 리눅스서버 시간 한국 시간(한국표준시;KST)으로 변경 2014.03.26 8019
146 netstat [option] 2014.04.12 7238
145 리눅스 Iptables 보안정책 2014.04.23 7776
144 리눅스 보안 - 시작 프로그램 수동 등록 및 서버 표준시간 설정 2014.04.23 7817
143 iptables 접속 차단 스크립트 2014.04.23 7665
142 리눅스 방화벽 iptables 설정 2014.04.23 8220
141 find - 파일 검색 2014.04.29 7200
140 문자셋 설정, charset 2014.04.29 7480
139 리눅스 기본보안설정(1-8) 2014.05.15 7636
138 리눅스 기본보안설정(9) file 2014.05.15 7514
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 12 Next
/ 12

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

© k2s0o1d4e0s2i1g5n. All Rights Reserved