티스토리 뷰

APM
Apache + PHP + MySQL(MariaDB)

 
 

아파치 설치

sudo apt-get install apache2

 

PHP 설치

sudo apt-get install php

 

아파치 + PHP 연동모듈 설치

sudo apt-get install libapache2-mod-php

 

MySQL 설치

sudo apt-get install mysql-server

MariaDB가 설치되었다고 걱정할 필요는 없다.

 

PHP + DB 연동모듈 설치

sudo apt-get install php-mysql

 

비밀번호 설정

sudo mysql_secure_installation

 

인증방식 변경

sudo mysql

PASSWORD는 루트(root) 비밀번호로 입력한다.

use mysql;
update user set plugin='' where User='root';
update user set password=password("PASSWORD") where user='root';
flush privileges;
exit;

 

디비 언어셋 확인

sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci

 


추가로 html 파일 내에 php 코드를 동작시키고 싶다면…?

sudo vi /etc/apache2/mods-enabled/php7.0.conf
<FilesMatch ".+\.html|ph(p[3457]?|t|tml)$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch ".+\.phps$">
    SetHandler application/x-httpd-php-source
    # Deny access to raw php sources by default
    # To re-enable it's recommended to enable access to the files
    # only in specific virtual host or directory
    Require all denied
</FilesMatch>
# Deny access to files without filename (e.g. '.php')
<FilesMatch "^\.ph(p[3457]?|t|tml|ps)$">
    Require all denied
</FilesMatch>

# Running PHP scripts in user directories is disabled by default
#
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
    <Directory /home/*/public_html>
        #php_admin_flag engine Off
    </Directory>
</IfModule>

'OS > Linux' 카테고리의 다른 글

[Ubuntu] 커널 컴파일(Kernel Compile)  (0) 2017.03.15
[Ubuntu] Ubuntu 16.04 (64bit) + Apache2 + GitLab  (0) 2017.01.17
[Ubuntu][Tip] bash 말고 zsh 로 쉘(shell) 이쁘게 쓰기  (0) 2016.12.03
[Ubuntu][Tip] 이쁘게  (0) 2014.03.14
ARM EMULATING  (0) 2014.03.01
댓글