메뉴 건너뛰기

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

단축키

Prev이전 문서

Next다음 문서

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

단축키

Prev이전 문서

Next다음 문서

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

/*---------------------------------------------------------------------------------------*/

이제 깔아보자..php 이것만 깔면 웹서버 구색이 갖춰지는군..

요점은 맨밑에 ...

/*---------------------------------------------------------------------------------------*/ 

[root@localhost ~]# yum groupinstall php <-(php관련 그룹을 모두 인스톨한다)
Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
base                                                     | 3.6 kB     00:00    
extras                                                   | 3.4 kB     00:00    
mysql-connectors-community                               | 2.5 kB     00:00    
mysql-tools-community                                    | 2.5 kB     00:00    
mysql56-community                                        | 2.5 kB     00:00    
updates                                                  | 3.4 kB     00:00    
mysql56-community/x86_64/primary_db                        |  92 kB   00:00    
Loading mirror speeds from cached hostfile
 * base: data.nicehosting.co.kr
 * extras: data.nicehosting.co.kr
 * updates: data.nicehosting.co.kr
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.4.16-23.el7_0.3 will be installed
--생략--
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package            Arch          Version                     Repository   Size
================================================================================
Installing for group install "PHP 吏?:
 php                x86_64        5.4.16-23.el7_0.3           base        1.3 M
 php-gd             x86_64        5.4.16-23.el7_0.3           base        124 k
 php-pdo            x86_64        5.4.16-23.el7_0.3           base         95 k
 php-pear           noarch        1:1.9.4-21.el7              base        357 k
 php-xml            x86_64        5.4.16-23.el7_0.3           base        122 k
Installing for dependencies:
 libXpm             x86_64        3.5.10-5.1.el7              base         52 k
 libxslt            x86_64        1.1.28-5.el7                base        242 k
 libzip             x86_64        0.10.1-8.el7                base         48 k
 php-cli            x86_64        5.4.16-23.el7_0.3           base        2.7 M
 php-common         x86_64        5.4.16-23.el7_0.3           base        561 k
 php-process        x86_64        5.4.16-23.el7_0.3           base         52 k
 t1lib              x86_64        5.1.2-14.el7                base        166 k

Transaction Summary
================================================================================
Install  5 Packages (+7 Dependent packages)

Total download size: 5.9 M
Installed size: 21 M
Is this ok [y/d/N]: y
Downloading packages:
(1/12): libXpm-3.5.10-5.1.el7.x86_64.rpm                   |  52 kB   00:00     
--생략-- 
(12/12): php-5.4.16-23.el7_0.3.x86_64.rpm                  | 1.3 MB   00:01    
--------------------------------------------------------------------------------
Total                                              4.4 MB/s | 5.9 MB  00:01    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libzip-0.10.1-8.el7.x86_64                                  1/12 
  --생략--
  Installing : php-pdo-5.4.16-23.el7_0.3.x86_64                       12/12
  Verifying  : php-common-5.4.16-23.el7_0.3.x86_64                  1/12 
  --생략--
  Verifying  : 1:php-pear-1.9.4-21.el7.noarch                           12/12

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-pdo.x86_64 0:5.4.16-23.el7_0.3      php-pear.noarch 1:1.9.4-21.el7       
  php-xml.x86_64 0:5.4.16-23.el7_0.3    

Dependency Installed:
  libXpm.x86_64 0:3.5.10-5.1.el7         libxslt.x86_64 0:1.1.28-5.el7         
  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-process.x86_64 0:5.4.16-23.el7_0.3
  t1lib.x86_64 0:5.1.2-14.el7          

Complete!
[root@localhost ~]#  

/*---------------------------------------------------------------------------------------*/

작동하는지 php명령어를 입력하고 접속해보자

/*---------------------------------------------------------------------------------------*/

[root@localhost ~]# vi /var/www/html/test.php <-(경로잘 봐.. 다음부턴 툴을 사용하고 지금은 간단히
<?php
phpinfo();
?>
~
"/var/www/html/test.php" [New] 3L, 17C written
[root@localhost ~]#  

/*---------------------------------------------------------------------------------------*/

어라??? 왜 안되지?? 아항 아파치를 재구동 해야하나.. 그럼 해보지 뭐~!

/*---------------------------------------------------------------------------------------*/

[root@localhost ~]# systemctl restart httpd <-(아파치 재구동)

/*---------------------------------------------------------------------------------------*/

재구동도 안되네.. 그럼 네이버검색해보자 어케 하는건지.. 구글링중~~~

아하.. 아파치설정을 해야하는구나.. 그럼 httpd.conf의 내용을 수정하자..

수정할 내용은

AddType application/x-httpd-php .php .php3 .html .htm

AddType application/x-httpd-php .php-source .phps 요거(2줄)라네요

설정파일을 찾아보자~~

/*---------------------------------------------------------------------------------------*/

[root@localhost ~]# find / -name httpd.conf <-(파일찾는명령 자주쓰는 명령이지...ㅋ)
/etc/httpd/conf/httpd.conf
/usr/lib/tmpfiles.d/httpd.conf
[root@localhost ~]# vi /etc/httpd/conf/httpd.conf <-(vi 편집기 알아야될 명령어 i / esc키 :(콜론) w / q)

# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.

--생략--

ServerRoot "/etc/httpd"

#Listen 12.34.56.78:80
Listen 80

--생략--

Include conf.modules.d/*.conf

#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User apache
Group apache

--생략--

#ServerName www.example.com:80

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
    AllowOverride none
    Require all denied
</Directory>

--생략--

 # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml

    AddType application/x-httpd-php .php .php3 .html .htm 

    AddType application/x-httpd-php-source .phps

(2줄입력하고 esc키 누르고 :(콜론)누르고 wq입력하고 enter 하면 저장후 종료된다)
</IfModule>

[root@localhost ~]# systemctl restart httpd <-(아파치 재구동)

/*---------------------------------------------------------------------------------------*/

오 된다... 그런데 한가지 의문점.. php 구문은<? ?> 요런식으로 한다. <?php ?> 요렇게도 하고

근데 <? ?>요렇게 했더니 안나온다.. 뭔가 설정이 있는듯.. 찾아보자.. 구글링중~~!!

찾았다...

short_open_tag = On “<?php” 와 “<?” 를 사용 할 수 있도록 한다. 요거다..

이설정은 php.ini에서 한다.. 그럼 시작

/*---------------------------------------------------------------------------------------*/ 

[root@localhost ~]# find / -name php.ini
/etc/php.ini

[root@localhost ~]# vi /etc/php.ini

[PHP]

;;;;;;;;;;;;;;;;;;;
; About php.ini   ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
--생략-- 

;;;;;;;;;;;;;;;;;;;;
; Language Options ;
;;;;;;;;;;;;;;;;;;;;

; Enable the PHP scripting language engine under Apache.
; http://php.net/engine
engine = On

; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It's been
; recommended for several years that you not use the short tag "short cut" and
; instead to use the full <?php and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages, the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time, it's currently still
; supported for backwards compatibility, but we recommend you don't use them.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = Off <-(요거를 on으로 바꿔주자) 

--생략--

"/etc/php.ini" 1797L, 64944C written
[root@localhost ~]#

/*---------------------------------------------------------------------------------------*/

그럼 소스를 <?php phpinfo(); ?> --> <? phpinfo(); ?> 요렇게 바꿔보고 해보자..

/*---------------------------------------------------------------------------------------*/

[root@localhost ~]# vi /var/www/html/test.php
<?
phpinfo();
?>
~
"/var/www/html/test.php" 3L, 17C written
[root@localhost ~]# systemctl restart httpd <-(아파치서버 재시작)

/*---------------------------------------------------------------------------------------*/

되는거 확인 되었다.. 예~~

요점정리

1. [root@localhost ~]# yum groupinstall php <-(php관련 그룹을 모두 인스톨한다)

2. [root@localhost ~]# vi /etc/httpd/conf/httpd.conf

   AddType application/x-httpd-php .php .php3 .html .htm

   AddType application/x-httpd-php .php-source .phps

   위 두줄 입력하고 저장

3. [root@localhost ~]# vi /etc/php.ini

   short_open_tag = Off <-(요거를 on으로 바꿔주자)-->short_open_tag = On 

4. [root@localhost ~]# systemctl restart httpd <-(아파치 재구동)

이렇게 간단히 끝났다.. 휴.. 정말 끝이네 이로써 그릇이 완성돼었다..

문제는 하면서 php.ini 설정과 httpd.conf 설정 파일을 만지게 될 것이다..

그때 그때 맞추서 하자. 지금 막 고쳐봐야 생각도 안나고 우선은 서버가 돌아가는데 집중하자.

/*---------------------------------------------------------------------------------------*/
 


List of Articles
번호 제목 날짜 조회 수
117 mariadb | my.cnf 설정. MariaDB(5.5.37) utf8 설정 2015.07.16 7711
116 CentOS 7 에 php 설치하기 2015.07.16 7663
115 CentOS 7 에 아파치(httpd) 설치 2015.07.16 10302
114 아파치 설치 2015.07.16 7864
113 시스템 보안점검 명령어들 file 2015.07.08 9372
112 리눅스 계정 파일 위치 file 2015.07.01 8117
111 hp Smart Array CLI 사용해서 논리드라이브 복구(Linux) 2015.06.16 9058
110 fdisk로 파티션 삭제하기 2015.06.10 26017
109 sulinux2.0 NFS 설정 & 공유 2015.06.10 7943
108 리눅스 마운트 (mount)를 해보자 file 2015.06.09 8529
107 리눅스 파티션(partition)을 나눠보자 file 2015.06.09 8438
106 fdisk로 파티션 삭제하기 2015.06.09 21721
105 리눅스,사용자계정(관련 파일,명령어) file 2014.10.30 7624
104 리눅스 기본보안설정(13) file 2014.05.15 7297
103 리눅스 기본보안설정(12) file 2014.05.15 7900
102 리눅스 기본보안설정(11) file 2014.05.15 8346
101 리눅스 기본보안설정(10) file 2014.05.15 7742
100 리눅스 기본보안설정(9) file 2014.05.15 7514
99 리눅스 기본보안설정(1-8) 2014.05.15 7630
98 문자셋 설정, charset 2014.04.29 7480
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 Next
/ 12

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

© k2s0o1d4e0s2i1g5n. All Rights Reserved