CentOS 7.x 기본 PHP 버전은 5.4 버전입니다.

그런데 하나의 서버에 여러가지 버전별로 설치하여 VirtualHost 별로 서로 다른 버전이 동작하도록 설정이 가능합니다.

nginx 라면 포트를 이용해서 분기하는 방법이 있습니다.

그리고 Apache 는 mod_fcgid 이라는 모듈을 이용합니다.

 

yum install epel-release 
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm 

yum install yum-utils 

 

기본적으로 운영할 버전을 설정 ( 5.4 를 기본으로 한다면 패스해도 됨 )
yum-config-manager --enable remi-php56

yum-config-manager --enable remi-php70

yum-config-manager --enable remi-php71

yum-config-manager --enable remi-php72

 

위에서 지정한 버전으로 설치 ( 디폴트 PHP 버전 )

# yum install php php-common php-fpm php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo

 

PHP 버전별로 설치를 합니다.

yum install php56 php56-php-common php56-php-fpm php56-php-mysql php56-php-pecl-memcache php56-php-pecl-memcached php56-php-gd php56-php-mbstring php56-php-mcrypt php56-php-xml php56-php-pecl-apc php56-php-cli php56-php-pear php56-php-pdo 
yum install php70 php70-php-common php70-php-fpm php70-php-mysql php70-php-pecl-memcache php70-php-pecl-memcached php70-php-gd php70-php-mbstring php70-php-mcrypt php70-php-xml php70-php-pecl-apc php70-php-cli php70-php-pear php70-php-pdo 
yum install php71 php71-php-common php71-php-fpm php71-php-mysql php71-php-pecl-memcache php71-php-pecl-memcached php71-php-gd php71-php-mbstring php71-php-mcrypt php71-php-xml php71-php-pecl-apc php71-php-cli php71-php-pear php71-php-pdo 
yum install php72 php72-php-common php72-php-fpm php72-php-mysql php72-php-pecl-memcache php72-php-pecl-memcached php72-php-gd php72-php-mbstring php72-php-mcrypt php72-php-xml php72-php-pecl-apc php72-php-cli php72-php-pear php72-php-pdo 

 

yum install mod_fcgid

 

vi /var/www/cgi-bin/php56.fcgi
vi /var/www/cgi-bin/php70.fcgi
vi /var/www/cgi-bin/php71.fcgi
vi /var/www/cgi-bin/php72.fcgi

 

#!/bin/bash
PHPRC=/etc/opt/remi/php56
export PHPRC
umask 022
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=1000
export PHP_FCGI_MAX_REQUESTS
SCRIPT_FILENAME=$PATH_TRANSLATED
export SCRIPT_FILENAME
exec /opt/remi/php56/root/usr/bin/php-cgi

버전 숫자에 맞게 고쳐서 저장합니다.

 

chmod 755 /var/www/cgi-bin/php*.fcgi

 

VirtualHost 설정

<Directory "/home/*/www">
    AllowOverride FileInfo AuthConfig Limit Indexes Options=ExecCGI
    Options +ExecCGI
    Require all granted
    AddType application/x-httpd-php .php .html
</Directory>
<VirtualHost *:80>
    ServerName 192.168.100.102
    DocumentRoot /home/example/www
</VirtualHost>
Listen 8054
Listen 8056
Listen 8070
Listen 8071
Listen 8072
<VirtualHost *:8054>
    ServerName 192.168.100.102
    DocumentRoot /home/example/www
</VirtualHost>
<VirtualHost *:8056>
    ServerName 192.168.100.102
    DocumentRoot /home/example/www
    <IfModule mod_fcgid.c>
        AddHandler fcgid-script .php
        FCGIWrapper /var/www/cgi-bin/php56.fcgi .php
    </IfModule>
</VirtualHost>
<VirtualHost *:8070>
    ServerName 192.168.100.102
    DocumentRoot /home/example/www
    <IfModule mod_fcgid.c>
        AddHandler fcgid-script .php
        FCGIWrapper /var/www/cgi-bin/php70.fcgi .php
    </IfModule>
</VirtualHost>
<VirtualHost *:8071>
    ServerName 192.168.100.102
    DocumentRoot /home/example/www
    <IfModule mod_fcgid.c>
        AddHandler fcgid-script .php
        FCGIWrapper /var/www/cgi-bin/php71.fcgi .php
    </IfModule>
</VirtualHost>
<VirtualHost *:8072>
    ServerName 192.168.100.102
    DocumentRoot /home/example/www
    <IfModule mod_fcgid.c>
        AddHandler fcgid-script .php
        FCGIWrapper /var/www/cgi-bin/php72.fcgi .php
    </IfModule>
</VirtualHost>

8054, 8056, 8070, 8071, 8072 포트는 PHP 각 버전별로 잘 작동하는지 확인하기 위한 예제입니다.

같은 80 포트에 Virtual 도메인별로 설정하시면 됩니다.

 

이제 아파치를 재시작하고 phpinfo 함수로 제대로 설정이 되었는지 확인하면 됩니다.

 

php.ini 는 각 버전별로 파일이 있으니 각각 수정하여야 합니다.

  /etc/php.ini 

  /opt/remi/php54/root/etc/php.ini 
  /opt/remi/php56/root/etc/php.ini 
  /etc/opt/remi/php70/
php.ini 
  /etc/opt/remi/php71/php.ini
  /etc/opt/remi/php72/php.ini 
버전별로 관리하기가 번거롭다면 /var/www/cgi-bin/php??.fcgi 파일에서 PHPRC=/etc/php.ini 로 수정하면 됩니다.

 

.html 은 잘 되는데 .php 파일은 제대로 적용이 안된다면
/etc/httpd/conf.d/php.conf 파일에 SetHandler application/x-httpd-php 부분을 찾아서 주석처리를 해주시면 됩니다.

 

블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

CentOS 7.x 버전에서 yum 으로 php 를 설치하면 기본으로 5.4 버전이 설치가 됩니다.

5.6 버전 또는 7.0 ~ 7.2 버전으로 설치하는 방법니다.

 

yum install epel-release
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

yum install yum-utils

 

5.6 버전 설치
yum-config-manager --enable remi-php56

 

7.0 버전 설치
yum-config-manager --enable remi-php70

 

7.1 버전 설치
yum-config-manager --enable remi-php71

 

7.2 버전 설치
yum-config-manager --enable remi-php72

 

yum install php php-common php-fpm php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo

 

5.4 버전이 설치된 상태라면 yum update 를 하시면 됩니다.

 

블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

요즘 나오는 노트북이나 메이커 컴퓨터는 Secure Boot 옵션이 디폴트로 Enabled 인가 봅니다.

그래서 인증되지 않는 OS 부팅을 허용하지 않고 윈도우만 되는가 봅니다~ ㅎ

CentOS Linux 로 부팅하려고 시도하니 그냥은 안되더군요~

BIOS 설정을 변경하여 부팅에 성공했습니다.

Dell Inspiron Secure Boot

먼저, Secure Boot 메뉴로 가서 Disabled 로 변경합니다.

 

Dell Inspiron PTT On

다음은, Security 메뉴로 가서 PTT Security 의 PTT On 체크를 해제하고 저장합니다.

 

Dell Inspiron Advanced Boot Options

그리고, Advanced Boot Options 메뉴의 Enable Legacy Option ROMs 를 체크하고 저장합니다.

여기까지만 하면 켤때 F12 Key 를 눌러서 부팅 메뉴에서 USB 로 부팅을 할 수가 있습니다.

 

Dell Inspiron Boot Sequence

부팅 순서를 지정하려면 Boot Sequence 메뉴에서 부팅 순서를 변경하고 저장하면 됩니다.

 

Dell Inspiron LEGACY BOOT

F12 키를 눌러서 부팅 메뉴를 선택하는 화면입니다.

 

'IT제품' 카테고리의 다른 글

구형 넷북 SSD 교체  (0) 2019.05.12
샤프 아쿠오스 S3 FS8032 CPU-Z 정보  (3) 2019.05.09
BIOSTAR S100 120GB CrystalDiskInfo  (0) 2018.12.10
Intel SSD 330 Series 60G 벤치  (0) 2018.11.13
노트북 하드디스크 SSD로 교체  (0) 2018.11.11
블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,

sed 명령어로 문자열 치환시 ' $ 두 문자가 들어가야 되는데 sed -i 's/찾는문자열/바꿀문자열/g' 방법으로는 원하는대로 되지가 않습니다.

 

/etc/phpMyAdmin/config.inc.php 파일의 맨 아랫줄에

"$cfg['LoginCookieValidity'] = 43200;" 를 추가하려고 하는데 애를 먹었네요~

 

sed -i "s/^?>/\$cfg['LoginCookieValidity'] = 43200;\n?>/g" /etc/phpMyAdmin/config.inc.php

 

sed -i "s/찾는문자열/바꿀문자열/g" 파일경로 이렇게 큰따옴표로 감싸면 됩니다.

그리고 $는 앞에 \를 붙여주면 됩니다.

 

 

블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,