From 0ab2c3d7754dad324d2e54e80a7a6ed9b8c20518 Mon Sep 17 00:00:00 2001 From: Been Kyung-yoon Date: Mon, 30 Nov 2020 10:33:17 +0900 Subject: [PATCH 1/4] =?UTF-8?q?#77=20PHP=208.0=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EC=A7=80=EC=9B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- app-install.sh | 4 ++-- includes/function.inc.sh | 6 +++++- install.sh | 6 ++++++ nginx/1-fastcgi-php80.conf | 4 ++++ stack.defaults.conf | 1 + 6 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 nginx/1-fastcgi-php80.conf diff --git a/README.md b/README.md index e36c6dc..c0339b0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # php79 stack -> PHP 5.3 ~ 7.4 + Nginx + Let's Encrypt + MariaDB + 앱들을 자동 설치합니다. +> PHP 5.3 ~ 8.0 + Nginx + Let's Encrypt + MariaDB + 앱들을 자동 설치합니다. ## 특징 @@ -8,7 +8,7 @@ - 쉽고 빠른 설치, 운영, 업데이트까지 고려한 설계 - 쉬운 업데이트 지원. (공식+인기 저장소를 사용하여 `yum update` 만으로 완료) - 기본 설정 파일의 수정을 최소화하여 혼란 예방. (주요 설정 내용을 z-php79.ini 형태의 외부 파일로 분리) -- PHP 5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4 9가지 버전을 지원하며, 하나의 서버에서 2개 이상의 PHP 사용 가능. +- PHP 5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 10가지 버전을 지원하며, 하나의 서버에서 2개 이상의 PHP 사용 가능. - Laravel 5.1~5.5, WordPress, XE, 그누보드 4/5, phpMyAdmin 자동 설치 지원. ([app-install.sh](app-install.sh)) - 시스템 계정, 디비 계정 자동 생성 지원. ([user-add.sh](user-add.sh)) - [Let's Encrypt - 무료 SSL 인증서 발급 및 갱신 지원](https://github.com/php79/stack/wiki/letsencrypt) ([ssl-install.sh](ssl-install.sh)) @@ -103,7 +103,7 @@ cd /root/stack ## 설치 내역 -### PHP 5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4 +### PHP 5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 - 단, CentOS 7 의 PHP 5.3 공식 저장소가 없어, 소스 컴파일 설치됩니다. - composer 설치 diff --git a/app-install.sh b/app-install.sh index 411cf7d..f4460c3 100755 --- a/app-install.sh +++ b/app-install.sh @@ -64,7 +64,7 @@ function show_usage echo -n " " outputInfo "--php" - echo " PHP 버전을 [ 53 54 55 56 56 70 71 72 73 74 ] 형식으로 하나만 입력하세요." + echo " PHP 버전을 [ 53 54 55 56 56 70 71 72 73 74 80 ] 형식으로 하나만 입력하세요." echo " Tip) Laravel 은 70, 그누보드4 는 53 등 프로그램에 따라 적절히 선택하세요." echo " ./status.sh 명령을 통해 현재 서버에 설치된 PHP 버전을 확인할 수 있습니다." echo @@ -166,7 +166,7 @@ if [ -z ${INPUT_PHP_VERSION} ]; then fi if [ ! -f "/usr/bin/php${INPUT_PHP_VERSION}" ]; then - input_abort "PHP ${INPUT_PHP_VERSION} 버전은 아직 설치되지 않았습니다. 입력 형식) 53 54 55 56 70 71 72 73 74" + input_abort "PHP ${INPUT_PHP_VERSION} 버전은 아직 설치되지 않았습니다. 입력 형식) 53 54 55 56 70 71 72 73 74 80" fi # nginx 중복 체크 diff --git a/includes/function.inc.sh b/includes/function.inc.sh index 1a3d7d4..ced53af 100644 --- a/includes/function.inc.sh +++ b/includes/function.inc.sh @@ -94,7 +94,7 @@ function welcome_short function welcome { welcome_short - echo " * PHP 5.3-7.4 + Nginx + Let's Encrypt + MariaDB installer" + echo " * PHP 5.3-8.0 + Nginx + Let's Encrypt + MariaDB installer" echo } @@ -102,6 +102,10 @@ function options { printf " - Install ${GREEN}EPEL repo${NO_COLOR} / http://fedoraproject.org/wiki/EPEL\n" + if [ $PHP80 = "1" ]; then + printf " - Install ${GREEN}PHP 8.0${NO_COLOR} from Remi repo / http://rpms.famillecollet.com/\n" + fi + if [ $PHP74 = "1" ]; then printf " - Install ${GREEN}PHP 7.4${NO_COLOR} from Remi repo / http://rpms.famillecollet.com/\n" fi diff --git a/install.sh b/install.sh index 9ddaf97..2b9cc02 100755 --- a/install.sh +++ b/install.sh @@ -108,6 +108,12 @@ if [ $PHP74 = "1" ]; then PHP_INSTALLED=74 fi +if [ $PHP80 = "1" ]; then + cmd_once "scripts/remi-repo-install.sh" + cmd_once "scripts/php7-remi-install.sh 80" + PHP_INSTALLED=80 +fi + ### /usr/bin/php link if [ ! $PHP_INSTALLED = "" ]; then if [ $OS = "centos7" ]; then diff --git a/nginx/1-fastcgi-php80.conf b/nginx/1-fastcgi-php80.conf new file mode 100644 index 0000000..5febce7 --- /dev/null +++ b/nginx/1-fastcgi-php80.conf @@ -0,0 +1,4 @@ +# http://nginx.org/en/docs/http/ngx_http_upstream_module.html +upstream php80_backend { + server 127.0.0.1:9080; +} diff --git a/stack.defaults.conf b/stack.defaults.conf index b194d7b..caeab80 100644 --- a/stack.defaults.conf +++ b/stack.defaults.conf @@ -16,6 +16,7 @@ PHP71=0 PHP72=0 PHP73=0 PHP74=1 +PHP80=0 # PHP CLI ( /usr/bin/php ) 에서 사용할 PHP 버전을 선택해주세요. PHP_BASE=74 From 1b7fd2dfb695d88f5999888a11ca6c7a3193e892 Mon Sep 17 00:00:00 2001 From: Been Kyung-yoon Date: Mon, 30 Nov 2020 10:40:15 +0900 Subject: [PATCH 2/4] =?UTF-8?q?#77=20PHP=208.0=20php-pecl-mysql=20?= =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=20=EC=97=86=EC=9C=BC=EB=AF=80?= =?UTF-8?q?=EB=A1=9C=20=EC=A0=9C=EC=99=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 2 +- scripts/php8-remi-install.sh | 51 ++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 scripts/php8-remi-install.sh diff --git a/install.sh b/install.sh index 2b9cc02..4f1cdae 100755 --- a/install.sh +++ b/install.sh @@ -110,7 +110,7 @@ fi if [ $PHP80 = "1" ]; then cmd_once "scripts/remi-repo-install.sh" - cmd_once "scripts/php7-remi-install.sh 80" + cmd_once "scripts/php8-remi-install.sh 80" PHP_INSTALLED=80 fi diff --git a/scripts/php8-remi-install.sh b/scripts/php8-remi-install.sh new file mode 100644 index 0000000..b4ea50e --- /dev/null +++ b/scripts/php8-remi-install.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# Copyright:: Copyright (c) 2016 Been Kyung-yoon (http://www.php79.com/) +# License:: The MIT License (MIT) + +# PHP 8 차이점 - php80-php-pecl-mysql 패키지 없음 + +STACK_ROOT=$( dirname $( cd "$( dirname "$0" )" && pwd ) ) +source "${STACK_ROOT}/includes/function.inc.sh" + +title "PHP [${1}] 버전을 설치합니다." + +if [ -z ${1} ]; then + abort "설치할 PHP 버전을 입력하세요. 80" +fi + +yum_install php$1-php-cli php$1-php-fpm \ +php$1-php-common php$1-php-pdo php$1-php-mysqlnd php$1-php-mbstring php$1-php-mcrypt \ +php$1-php-opcache php$1-php-xml php$1-php-pecl-imagick php$1-php-gd php$1-php-fileinfo \ +php$1-php-pecl-zip php$1-php-bcmath + +if [ ! -f "/etc/opt/remi/php${1}/php.d/z-php79.ini" ]; then + notice "PHP 권장 설정이 추가되었습니다.\n설정 파일 경로) /etc/opt/remi/php${1}/php.d/z-php79.ini" + cp -av "${STACK_ROOT}/php/80/z-php79.ini" "/etc/opt/remi/php${1}/php.d/" + string_quote ${TIMEZONE} + sed -i "s/^date.timezone =.*/date.timezone = ${STRING_QUOTE}/g" "/etc/opt/remi/php${1}/php.d/z-php79.ini" +fi + +PHP_FPM_CONF=/etc/opt/remi/php$1/php-fpm.d/www.conf +sed -i 's/^;security.limit_extensions = .php .php3 .php4 .php5/security.limit_extensions = .php .html .htm .inc/g' $PHP_FPM_CONF +sed -i 's/^user = apache/user = nobody/g' $PHP_FPM_CONF +sed -i 's/^group = apache/group = nobody/g' $PHP_FPM_CONF +sed -i 's/^listen = 127.0.0.1:9000/listen = 127.0.0.1:90'$1'/g' $PHP_FPM_CONF + +chgrp -v nobody /var/opt/remi/php$1/lib/php/* +chown -v nobody /var/opt/remi/php$1/log/php-fpm + +if [ $OS = "centos7" ]; then + systemctl enable php$1-php-fpm + systemctl start php$1-php-fpm +else + chkconfig php$1-php-fpm on + service php$1-php-fpm start +fi + +# nginx 설치된 경우만 복사 +if [ -f /etc/nginx/conf.d/0-php79.conf ]; then + if [ ! -f "/etc/nginx/conf.d/1-fastcgi-php${1}.conf" ]; then + cp -av "${STACK_ROOT}/nginx/1-fastcgi-php${1}.conf" /etc/nginx/conf.d/ + fi +fi From 0ccf785e452d47e7f16f24ea2e000cd218eb8bf5 Mon Sep 17 00:00:00 2001 From: Been Kyung-yoon Date: Mon, 30 Nov 2020 10:40:34 +0900 Subject: [PATCH 3/4] =?UTF-8?q?#77=20PHP=208.0=20=EA=B6=8C=EC=9E=A5=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=ED=8C=8C=EC=9D=BC=20=EC=9A=B0=EC=84=A0=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC(=ED=98=84=EC=9E=AC=EB=8A=94=20PHP=207?= =?UTF-8?q?=EA=B3=BC=20=EB=82=B4=EC=9A=A9=20=EB=8F=99=EC=9D=BC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- php/80/z-php79.ini | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 php/80/z-php79.ini diff --git a/php/80/z-php79.ini b/php/80/z-php79.ini new file mode 100644 index 0000000..d62c74e --- /dev/null +++ b/php/80/z-php79.ini @@ -0,0 +1,67 @@ +; Modern PHP 소스용 권장 설정 +; updated: 2016-04-01 + +[PHP79] +; 타임존. 미선언 상태에서 date() 등 사용시 경고 발생. +date.timezone = Asia/Seoul + +; PHP 버전 숨기기 +expose_php = Off + +; 레거시 코드에 Date: Mon, 30 Nov 2020 10:42:17 +0900 Subject: [PATCH 4/4] =?UTF-8?q?#77=20=EC=8B=A4=ED=96=89=20=EA=B6=8C?= =?UTF-8?q?=ED=95=9C=20=EB=B6=80=EC=97=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/php8-remi-install.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/php8-remi-install.sh diff --git a/scripts/php8-remi-install.sh b/scripts/php8-remi-install.sh old mode 100644 new mode 100755