OS/Linux - Ubuntu

[Linux - 리눅스 / Ubuntu - 우분투] PHP 설치하기 - APM(A : Apache, P : PHP, M : MySQL or MariaDB)

주누다 2015. 5. 8. 13:57
반응형

APM과 게시판 설치

- 리눅스에서는 웹 서버 아파치와 웹 프로그래밍 언어인 PHP, 데이터베이스인 MySQL  을 묶어서 APM이라고 함

- 웹 페이지에서 흔히 사용하는 게시판도 APM 을 이용하여 개발된 것이 많음

- MariaDB는 MySQL 과 완벽하게 호환되므로 MariaDB를 사용하여 APM을 동작




APM 설치하기 - PHP 

- PHP 패키지는 'php5', 'php5-gd', 'php5-mysql' 

- apt-get 명령으로 한 번에 설치 가능

 

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

sjw@sjw-HP-Mini-110-3500:~/public_html$ cd
sjw@sjw-HP-Mini-110-3500:~$ apt-get install php5 php5-gd php5-mysql
E: 잠금 파일 /var/lib/dpkg/lock 파일을 열 수 없습니다 - open (13: 허가 거부)
E: 관리 디렉터리를 (/var/lib/dpkg/) 잠글 수 없습니다. 루트 사용자가 맞습니까?
sjw@sjw-HP-Mini-110-3500:~$ cd
sjw@sjw-HP-Mini-110-3500:~$ sudo apt-get install php5 php5-gd php5-mysql
[sudo] password for sjw:
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다      
상태 정보를 읽는 중입니다... 완료
다음 패키지를 더 설치할 것입니다:
  libapache2-mod-php5 php5-cli php5-common php5-json php5-readline
제안하는 패키지:
  php-pear php5-user-cache
다음 새 패키지를 설치할 것입니다:
  libapache2-mod-php5 php5 php5-cli php5-common php5-gd php5-json php5-mysql
  php5-readline
0개 업그레이드, 8개 새로 설치, 0개 제거 및 3개 업그레이드 안 함.
4,952 k바이트 아카이브를 받아야 합니다.
이 작업 후 20.9 M바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까? [Y/n] y
받기:1 http://kr.archive.ubuntu.com/ubuntu/ trusty/main php5-json amd64 1.3.2-2build1 [34.4 kB]
받기:2 http://kr.archive.ubuntu.com/ubuntu/ trusty-updates/main php5-common amd64 5.5.9+dfsg-1ubuntu4.9 [442 kB]
받기:3 http://kr.archive.ubuntu.com/ubuntu/ trusty-updates/main php5-gd amd64 5.5.9+dfsg-1ubuntu4.9 [28.0 kB]
받기:4 http://kr.archive.ubuntu.com/ubuntu/ trusty-updates/main php5-mysql amd64 5.5.9+dfsg-1ubuntu4.9 [63.2 kB]
받기:5 http://kr.archive.ubuntu.com/ubuntu/ trusty-updates/main php5-cli amd64 5.5.9+dfsg-1ubuntu4.9 [2,163 kB]
받기:6 http://kr.archive.ubuntu.com/ubuntu/ trusty-updates/main php5-readline amd64 5.5.9+dfsg-1ubuntu4.9 [12.1 kB]
받기:7 http://kr.archive.ubuntu.com/ubuntu/ trusty-updates/main libapache2-mod-php5 amd64 5.5.9+dfsg-1ubuntu4.9 [2,208 kB]
받기:8 http://kr.archive.ubuntu.com/ubuntu/ trusty-updates/main php5 all 5.5.9+dfsg-1ubuntu4.9 [1,306 B]
내려받기 4,952 k바이트, 소요시간 10초 (468 k바이트/초)                        
Selecting previously unselected package php5-json.
(데이터베이스 읽는중 ...현재 232141개의 파일과 디렉터리가 설치되어 있습니다.)
Preparing to unpack .../php5-json_1.3.2-2build1_amd64.deb ...
Unpacking php5-json (1.3.2-2build1) ...
Selecting previously unselected package php5-common.
Preparing to unpack .../php5-common_5.5.9+dfsg-1ubuntu4.9_amd64.deb ...
Unpacking php5-common (5.5.9+dfsg-1ubuntu4.9) ...
Selecting previously unselected package php5-gd.
Preparing to unpack .../php5-gd_5.5.9+dfsg-1ubuntu4.9_amd64.deb ...
Unpacking php5-gd (5.5.9+dfsg-1ubuntu4.9) ...
Selecting previously unselected package php5-mysql.
Preparing to unpack .../php5-mysql_5.5.9+dfsg-1ubuntu4.9_amd64.deb ...
Unpacking php5-mysql (5.5.9+dfsg-1ubuntu4.9) ...
Selecting previously unselected package php5-cli.
Preparing to unpack .../php5-cli_5.5.9+dfsg-1ubuntu4.9_amd64.deb ...
Unpacking php5-cli (5.5.9+dfsg-1ubuntu4.9) ...
Selecting previously unselected package php5-readline.
Preparing to unpack .../php5-readline_5.5.9+dfsg-1ubuntu4.9_amd64.deb ...
Unpacking php5-readline (5.5.9+dfsg-1ubuntu4.9) ...
Selecting previously unselected package libapache2-mod-php5.
Preparing to unpack .../libapache2-mod-php5_5.5.9+dfsg-1ubuntu4.9_amd64.deb ...
Unpacking libapache2-mod-php5 (5.5.9+dfsg-1ubuntu4.9) ...
Selecting previously unselected package php5.
Preparing to unpack .../php5_5.5.9+dfsg-1ubuntu4.9_all.deb ...
Unpacking php5 (5.5.9+dfsg-1ubuntu4.9) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
php5-common (5.5.9+dfsg-1ubuntu4.9) 설정하는 중입니다 ...

Creating config file /etc/php5/mods-available/pdo.ini with new version
php5_invoke: Enable module pdo for apache2 SAPI
php5_invoke: Enable module pdo for cli SAPI

Creating config file /etc/php5/mods-available/opcache.ini with new version
php5_invoke: Enable module opcache for apache2 SAPI
php5_invoke: Enable module opcache for cli SAPI
php5-gd (5.5.9+dfsg-1ubuntu4.9) 설정하는 중입니다 ...

Creating config file /etc/php5/mods-available/gd.ini with new version
php5_invoke: Enable module gd for apache2 SAPI
php5_invoke: Enable module gd for cli SAPI
php5-mysql (5.5.9+dfsg-1ubuntu4.9) 설정하는 중입니다 ...

Creating config file /etc/php5/mods-available/mysql.ini with new version
php5_invoke: Enable module mysql for apache2 SAPI
php5_invoke: Enable module mysql for cli SAPI

Creating config file /etc/php5/mods-available/mysqli.ini with new version
php5_invoke: Enable module mysqli for apache2 SAPI
php5_invoke: Enable module mysqli for cli SAPI

Creating config file /etc/php5/mods-available/pdo_mysql.ini with new version
php5_invoke: Enable module pdo_mysql for apache2 SAPI
php5_invoke: Enable module pdo_mysql for cli SAPI
php5-cli (5.5.9+dfsg-1ubuntu4.9) 설정하는 중입니다 ...
update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in 자동 모드

Creating config file /etc/php5/cli/php.ini with new version
php5_invoke mysqli: already enabled for cli SAPI
php5_invoke opcache: already enabled for cli SAPI
php5_invoke mysql: already enabled for cli SAPI
php5_invoke pdo: already enabled for cli SAPI
php5_invoke gd: already enabled for cli SAPI
php5_invoke pdo_mysql: already enabled for cli SAPI
php5-readline (5.5.9+dfsg-1ubuntu4.9) 설정하는 중입니다 ...

Creating config file /etc/php5/mods-available/readline.ini with new version
php5_invoke: Enable module readline for apache2 SAPI
php5_invoke: Enable module readline for cli SAPI
libapache2-mod-php5 (5.5.9+dfsg-1ubuntu4.9) 설정하는 중입니다 ...

Creating config file /etc/php5/apache2/php.ini with new version
php5_invoke readline: already enabled for apache2 SAPI
php5_invoke mysqli: already enabled for apache2 SAPI
php5_invoke opcache: already enabled for apache2 SAPI
php5_invoke mysql: already enabled for apache2 SAPI
php5_invoke pdo: already enabled for apache2 SAPI
php5_invoke gd: already enabled for apache2 SAPI
php5_invoke pdo_mysql: already enabled for apache2 SAPI
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
 * Restarting web server apache2                                                AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
                                                                         [ OK ]
apache2_invoke: Enable module php5
 * Restarting web server apache2                                                AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
                                                                         [ OK ]
php5 (5.5.9+dfsg-1ubuntu4.9) 설정하는 중입니다 ...
php5-json (1.3.2-2build1) 설정하는 중입니다 ...
php5_invoke: Enable module json for apache2 SAPI
php5_invoke: Enable module json for cli SAPI
sjw@sjw-HP-Mini-110-3500:~$ 

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




PHP 동작 확인하기

- php가 정상적으로 동작하는지 확인하기 위해 '/var/www' 에 파일을 만들어 확인


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

sjw@sjw-HP-Mini-110-3500:/var/www$ sudo vi phpinfo.php


<?php phpinfo();?>
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
~                                                                              
"phpinfo.php" 1 line, 19 characters

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


- 'http://localhost/phpinfo.php' 로 확인




반응형