메뉴 건너뛰기

조회 수 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 설정 파일을 만지게 될 것이다..

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

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


  1. No Image

    특정 웹페이지에서 문자가 깨지는 경우 (인코딩 문제)

    Date2016.03.18 Views7553
    Read More
  2. No Image

    이온큐브로더(ioncube) 설치 매뉴얼

    Date2016.03.18 Views10391
    Read More
  3. [Linux]리눅스,사용자계정(관련 파일,명령어)

    Date2015.11.21 Views8159
    Read More
  4. No Image

    PHP-5.3 이상 Zend 설치

    Date2015.07.30 Views8698
    Read More
  5. Centos7 64bit 웹서버 만들기-소켓모듈설치(socket.io) CAP7

    Date2015.07.17 Views8552
    Read More
  6. Centos7 64bit 웹서버 만들기-PHP설치 CAP5

    Date2015.07.17 Views11979
    Read More
  7. Centos7 64bit 웹서버 만들기-mysql설치 CAP4

    Date2015.07.17 Views7655
    Read More
  8. No Image

    Centos7 64bit 웹서버 만들기-방화벽설치 CAP2

    Date2015.07.17 Views7838
    Read More
  9. No Image

    CentOS 7 Subversion(SVN)

    Date2015.07.17 Views7648
    Read More
  10. No Image

    CentOS 7 FTP Server 설치

    Date2015.07.17 Views7701
    Read More
  11. No Image

    cron을 이용한 DB자동백업

    Date2015.07.16 Views8204
    Read More
  12. No Image

    httpd.conf 기타 설정 사항

    Date2015.07.16 Views7368
    Read More
  13. No Image

    MySQL 계정생성하기

    Date2015.07.16 Views7511
    Read More
  14. No Image

    mysql root 비밀번호 설정

    Date2015.07.16 Views7858
    Read More
  15. No Image

    php-mbstring 설치

    Date2015.07.16 Views7776
    Read More
  16. No Image

    php.ini 파일에서 timezone 설정

    Date2015.07.16 Views7754
    Read More
  17. No Image

    아파치 재시작 없이 설정 적용

    Date2015.07.16 Views8184
    Read More
  18. No Image

    my.cnf 케릭터 셋 설정 (uft8)

    Date2015.07.16 Views7290
    Read More
  19. No Image

    centos 버전 확인

    Date2015.07.16 Views7614
    Read More
  20. No Image

    centos 7 계정추가

    Date2015.07.16 Views8598
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 12 Next
/ 12

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

© k2s0o1d4e0s2i1g5n. All Rights Reserved