[리눅스] PHP 버전 추가하기
- 04-29
- 34,489 회
- 0 건
기존에 설치된 PHP 버전이 7.4 였는데 테스트를 위해 8.2 를 추가함
[code]
yum -y install php82 php82-php-cli php82-php-fpm php82-php-common php82-php-devel php82-php-gd php82-php-pecl-imagick php82-php-mbstring php82-php-json php82-php-xml php82-php-mysqlnd php82-php-opcache php82-php-soap
sed -i 's/pm = dynamic/pm = ondemand/' /etc/opt/remi/php82/php-fpm.d/www.conf
sed -i 's/listen = 127.0.0.1:9000/listen = 127.0.0.1:9082/' /etc/opt/remi/php82/php-fpm.d/www.conf
sed -i 's/short_open_tag = Off/short_open_tag = On/' /etc/opt/remi/php82/php.ini
sed -i 's/;date.timezone =/date.timezone = Asia\/Seoul/' /etc/opt/remi/php82/php.ini
sed -i 's/error_reporting \= E_ALL \& \~E_DEPRECATED \& \~E_STRICT/error_reporting \= E_ALL \& \~E_NOTICE \& \~E_DEPRECATED/' /etc/opt/remi/php82/php.ini
sed -i 's/expose_php = On/expose_php = Off/' /etc/opt/remi/php82/php.ini
sed -i 's/memory_limit = 128M/memory_limit = 512M/' /etc/opt/remi/php82/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 32M/' /etc/opt/remi/php82/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 32M/' /etc/opt/remi/php82/php.ini
systemctl start php82-php-fpm
systemctl enable php82-php-fpm
[/code]
가상호스트를 통해 원하는 도메인만 해당 버전으로 연결
[code]
vi /etc/httpd/conf.d/vhost.conf
<VirtualHost>
...
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9082"
</FilesMatch>
</VirtualHost>
vi /etc/httpd/conf.d/vhost-le-ssl.conf
<VirtualHost>
...
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9082"
</FilesMatch>
</VirtualHost>
systemctl reload httpd.service
[/code]