호스팅 하고 있는 소스를 압축해서 새로운 환경에 복사 했는데 이상한 오류가 발생한다.
동일한 소스인데 오류가 발생하는 걸 보니 환경 설정이나 버전 문제인 것 같아 현재 버전을 먼저 확인한다.
오류 문구 확인
Parse error : Unclosed
버전 확인
php -v PHP 8.0.30 (cli) (built: Aug 3 2023 17:13:08) ( NTS gcc x86_64 ) Copyright (c) The PHP Group Zend Engine v4.0.30, Copyright (c) Zend Technologies with Zend OPcache v8.0.30, Copyright (c), by Zend Technologies
확인 해보니 기존 서버의 버전은 php 8.3 버전이고 php-v 버전을 확인하니 php 8.0.30 으로 업그레이드가 필요하다는 것을 알았습니다.
Remi 저장소 설치
# sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y Last metadata expiration check: 0:35:48 ago on Fri May 9 14:09:02 2025. remi-release-9.rpm 37 kB/s | 32 kB 00:00 Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Installing: remi-release noarch 9.5-2.el9.remi @commandline 32 k Transaction Summary ================================================================================ Install 1 Package Total size: 32 k Installed size: 34 k Downloading Packages: Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : remi-release-9.5-2.el9.remi.noarch 1/1 Verifying : remi-release-9.5-2.el9.remi.noarch 1/1 Installed: remi-release-9.5-2.el9.remi.noarch Complete!
Remi 저장소 활성화 및 PHP 8.3 모듈 활성화
# sudo dnf module reset php # sudo dnf module enable php:remi-8.3 -y Remi's Modular repository for Enterprise Linux 305 kB/s | 811 kB 00:02 Safe Remi's RPM repository for Enterprise Linux 476 kB/s | 1.2 MB 00:02 Dependencies resolved. Nothing to do. Complete! Last metadata expiration check: 0:00:02 ago on Fri May 9 14:45:02 2025. Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Enabling module streams: php remi-8.3 Transaction Summary ================================================================================ Complete!
PHP 8.3 및 필요한 확장 설치
# sudo dnf install php php-fpm php-mysqlnd php-opcache php-gd php-xml php-mbstring php-curl Last metadata expiration check: 0:00:04 ago on Fri May 9 14:45:02 2025. Package php-8.0.30-1.el9_2.x86_64 is already installed. Package php-fpm-8.0.30-1.el9_2.x86_64 is already installed. Package php-mysqlnd-8.0.30-1.el9_2.x86_64 is already installed. Package php-opcache-8.0.30-1.el9_2.x86_64 is already installed. Package php-gd-8.0.30-1.el9_2.x86_64 is already installed. Package php-xml-8.0.30-1.el9_2.x86_64 is already installed. Package php-mbstring-8.0.30-1.el9_2.x86_64 is already installed. Package php-common-8.0.30-1.el9_2.x86_64 is already installed. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Upgrading: php x86_64 8.3.21-1.el9.remi remi-modular 1.8 M php-cli x86_64 8.3.21-1.el9.remi remi-modular 5.6 M php-common x86_64 8.3.21-1.el9.remi remi-modular 1.3 M php-fpm x86_64 8.3.21-1.el9.remi remi-modular 1.9 M php-gd x86_64 8.3.21-1.el9.remi remi-modular 64 k php-mbstring x86_64 8.3.21-1.el9.remi remi-modular 581 k php-mysqlnd x86_64 8.3.21-1.el9.remi remi-modular 220 k php-opcache x86_64 8.3.21-1.el9.remi remi-modular 577 k php-pdo x86_64 8.3.21-1.el9.remi remi-modular 120 k php-xml x86_64 8.3.21-1.el9.remi remi-modular 221 k Installing dependencies: capstone x86_64 4.0.2-10.el9 appstream 766 k fribidi x86_64 1.0.10-6.el9.2 appstream 84 k gd3php x86_64 2.3.3-9.el9.remi remi-safe 136 k highway x86_64 1.2.0-2.el9 epel 35 k libaom x86_64 3.12.0-1.el9 epel 1.8 M libavif x86_64 0.11.1-5.el9 epel 80 k libdav1d x86_64 1.5.1-1.el9 epel 611 k libimagequant x86_64 2.17.0-1.el9 epel 62 k libjxl x86_64 0.7.0-1.el9 epel 957 k libraqm x86_64 0.8.0-1.el9 epel 19 k libsodium x86_64 1.0.18-8.el9 epel 161 k libvmaf x86_64 2.3.0-2.el9 epel 177 k oniguruma5php x86_64 6.9.10-1.el9.remi remi-safe 222 k rav1e-libs x86_64 0.7.1-3.el9 epel 1.0 M svt-av1-libs x86_64 0.9.0-1.el9 epel 1.7 M Installing weak dependencies: jxl-pixbuf-loader x86_64 0.7.0-1.el9 epel 53 k php-sodium x86_64 8.3.21-1.el9.remi remi-modular 61 k Transaction Summary ================================================================================ Install 17 Packages Upgrade 10 Packages Total download size: 20 M Is this ok [y/N]: y Downloading Packages: (1/27): jxl-pixbuf-loader-0.7.0-1.el9.x86_64.rp 1.2 MB/s | 53 kB 00:00 (2/27): highway-1.2.0-2.el9.x86_64.rpm 708 kB/s | 35 kB 00:00 (3/27): libavif-0.11.1-5.el9.x86_64.rpm 4.6 MB/s | 80 kB 00:00 (4/27): libdav1d-1.5.1-1.el9.x86_64.rpm 6.1 MB/s | 611 kB 00:00 (5/27): libimagequant-2.17.0-1.el9.x86_64.rpm 654 kB/s | 62 kB 00:00 (6/27): libaom-3.12.0-1.el9.x86_64.rpm 8.2 MB/s | 1.8 MB 00:00 (7/27): libraqm-0.8.0-1.el9.x86_64.rpm 151 kB/s | 19 kB 00:00 (8/27): libjxl-0.7.0-1.el9.x86_64.rpm 5.2 MB/s | 957 kB 00:00 (9/27): libsodium-1.0.18-8.el9.x86_64.rpm 1.2 MB/s | 161 kB 00:00 (10/27): libvmaf-2.3.0-2.el9.x86_64.rpm 2.2 MB/s | 177 kB 00:00 (11/27): rav1e-libs-0.7.1-3.el9.x86_64.rpm 5.0 MB/s | 1.0 MB 00:00 (12/27): svt-av1-libs-0.9.0-1.el9.x86_64.rpm 4.2 MB/s | 1.7 MB 00:00 (13/27): php-sodium-8.3.21-1.el9.remi.x86_64.rp 66 kB/s | 61 kB 00:00 (14/27): fribidi-1.0.10-6.el9.2.x86_64.rpm 1.6 MB/s | 84 kB 00:00 (15/27): capstone-4.0.2-10.el9.x86_64.rpm 7.1 MB/s | 766 kB 00:00 (16/27): gd3php-2.3.3-9.el9.remi.x86_64.rpm 102 kB/s | 136 kB 00:01 (17/27): oniguruma5php-6.9.10-1.el9.remi.x86_64 158 kB/s | 222 kB 00:01 (18/27): php-8.3.21-1.el9.remi.x86_64.rpm 1.3 MB/s | 1.8 MB 00:01 (19/27): php-common-8.3.21-1.el9.remi.x86_64.rp 1.7 MB/s | 1.3 MB 00:00 (20/27): php-gd-8.3.21-1.el9.remi.x86_64.rpm 262 kB/s | 64 kB 00:00 (21/27): php-mbstring-8.3.21-1.el9.remi.x86_64. 2.3 MB/s | 581 kB 00:00 (22/27): php-fpm-8.3.21-1.el9.remi.x86_64.rpm 2.7 MB/s | 1.9 MB 00:00 (23/27): php-mysqlnd-8.3.21-1.el9.remi.x86_64.r 910 kB/s | 220 kB 00:00 (24/27): php-pdo-8.3.21-1.el9.remi.x86_64.rpm 507 kB/s | 120 kB 00:00 (25/27): php-opcache-8.3.21-1.el9.remi.x86_64.r 1.2 MB/s | 577 kB 00:00 (26/27): php-xml-8.3.21-1.el9.remi.x86_64.rpm 930 kB/s | 221 kB 00:00 (27/27): php-cli-8.3.21-1.el9.remi.x86_64.rpm 673 kB/s | 5.6 MB 00:08 -------------------------------------------------------------------------------- Total 1.8 MB/s | 20 MB 00:11 Remi's Modular repository for Enterprise Linux 3.0 MB/s | 3.1 kB 00:00 Importing GPG key 0x478F8947: Userid : "Remi's RPM repository (https://rpms.remirepo.net/) <remi@remirepo.net>" Fingerprint: B1AB F71E 14C9 D748 97E1 98A8 B195 27F1 478F 8947 From : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el9 Is this ok [y/N]: y Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: php-common-8.3.21-1.el9.remi.x86_64 1/37 Upgrading : php-common-8.3.21-1.el9.remi.x86_64 1/37 warning: /etc/php.ini created as /etc/php.ini.rpmnew Upgrading : php-pdo-8.3.21-1.el9.remi.x86_64 2/37 Upgrading : php-cli-8.3.21-1.el9.remi.x86_64 3/37 Upgrading : php-fpm-8.3.21-1.el9.remi.x86_64 4/37 warning: /etc/httpd/conf.d/php.conf created as /etc/httpd/conf.d/php.conf.rpmnew Running scriptlet: php-fpm-8.3.21-1.el9.remi.x86_64 4/37 Upgrading : php-xml-8.3.21-1.el9.remi.x86_64 5/37 Installing : capstone-4.0.2-10.el9.x86_64 6/37 Upgrading : php-opcache-8.3.21-1.el9.remi.x86_64 7/37 Installing : fribidi-1.0.10-6.el9.2.x86_64 8/37 Installing : libraqm-0.8.0-1.el9.x86_64 9/37 Installing : oniguruma5php-6.9.10-1.el9.remi.x86_64 10/37 Upgrading : php-mbstring-8.3.21-1.el9.remi.x86_64 11/37 Installing : svt-av1-libs-0.9.0-1.el9.x86_64 12/37 Installing : rav1e-libs-0.7.1-3.el9.x86_64 13/37 Installing : libvmaf-2.3.0-2.el9.x86_64 14/37 Installing : libsodium-1.0.18-8.el9.x86_64 15/37 Installing : php-sodium-8.3.21-1.el9.remi.x86_64 16/37 Installing : libimagequant-2.17.0-1.el9.x86_64 17/37 Installing : libdav1d-1.5.1-1.el9.x86_64 18/37 Installing : highway-1.2.0-2.el9.x86_64 19/37 Installing : jxl-pixbuf-loader-0.7.0-1.el9.x86_64 20/37 Installing : libjxl-0.7.0-1.el9.x86_64 21/37 Installing : libaom-3.12.0-1.el9.x86_64 22/37 Installing : libavif-0.11.1-5.el9.x86_64 23/37 Installing : gd3php-2.3.3-9.el9.remi.x86_64 24/37 Upgrading : php-gd-8.3.21-1.el9.remi.x86_64 25/37 Upgrading : php-8.3.21-1.el9.remi.x86_64 26/37 Upgrading : php-mysqlnd-8.3.21-1.el9.remi.x86_64 27/37 Cleanup : php-8.0.30-1.el9_2.x86_64 28/37 Cleanup : php-cli-8.0.30-1.el9_2.x86_64 29/37 Running scriptlet: php-fpm-8.0.30-1.el9_2.x86_64 30/37 Cleanup : php-fpm-8.0.30-1.el9_2.x86_64 30/37 Cleanup : php-mbstring-8.0.30-1.el9_2.x86_64 31/37 Cleanup : php-opcache-8.0.30-1.el9_2.x86_64 32/37 Cleanup : php-xml-8.0.30-1.el9_2.x86_64 33/37 Cleanup : php-mysqlnd-8.0.30-1.el9_2.x86_64 34/37 Cleanup : php-pdo-8.0.30-1.el9_2.x86_64 35/37 Cleanup : php-gd-8.0.30-1.el9_2.x86_64 36/37 Cleanup : php-common-8.0.30-1.el9_2.x86_64 37/37 Running scriptlet: php-common-8.0.30-1.el9_2.x86_64 37/37 Verifying : highway-1.2.0-2.el9.x86_64 1/37 Verifying : jxl-pixbuf-loader-0.7.0-1.el9.x86_64 2/37 Verifying : libaom-3.12.0-1.el9.x86_64 3/37 Verifying : libavif-0.11.1-5.el9.x86_64 4/37 Verifying : libdav1d-1.5.1-1.el9.x86_64 5/37 Verifying : libimagequant-2.17.0-1.el9.x86_64 6/37 Verifying : libjxl-0.7.0-1.el9.x86_64 7/37 Verifying : libraqm-0.8.0-1.el9.x86_64 8/37 Verifying : libsodium-1.0.18-8.el9.x86_64 9/37 Verifying : libvmaf-2.3.0-2.el9.x86_64 10/37 Verifying : rav1e-libs-0.7.1-3.el9.x86_64 11/37 Verifying : svt-av1-libs-0.9.0-1.el9.x86_64 12/37 Verifying : php-sodium-8.3.21-1.el9.remi.x86_64 13/37 Verifying : gd3php-2.3.3-9.el9.remi.x86_64 14/37 Verifying : oniguruma5php-6.9.10-1.el9.remi.x86_64 15/37 Verifying : fribidi-1.0.10-6.el9.2.x86_64 16/37 Verifying : capstone-4.0.2-10.el9.x86_64 17/37 Verifying : php-8.3.21-1.el9.remi.x86_64 18/37 Verifying : php-8.0.30-1.el9_2.x86_64 19/37 Verifying : php-cli-8.3.21-1.el9.remi.x86_64 20/37 Verifying : php-cli-8.0.30-1.el9_2.x86_64 21/37 Verifying : php-common-8.3.21-1.el9.remi.x86_64 22/37 Verifying : php-common-8.0.30-1.el9_2.x86_64 23/37 Verifying : php-fpm-8.3.21-1.el9.remi.x86_64 24/37 Verifying : php-fpm-8.0.30-1.el9_2.x86_64 25/37 Verifying : php-gd-8.3.21-1.el9.remi.x86_64 26/37 Verifying : php-gd-8.0.30-1.el9_2.x86_64 27/37 Verifying : php-mbstring-8.3.21-1.el9.remi.x86_64 28/37 Verifying : php-mbstring-8.0.30-1.el9_2.x86_64 29/37 Verifying : php-mysqlnd-8.3.21-1.el9.remi.x86_64 30/37 Verifying : php-mysqlnd-8.0.30-1.el9_2.x86_64 31/37 Verifying : php-opcache-8.3.21-1.el9.remi.x86_64 32/37 Verifying : php-opcache-8.0.30-1.el9_2.x86_64 33/37 Verifying : php-pdo-8.3.21-1.el9.remi.x86_64 34/37 Verifying : php-pdo-8.0.30-1.el9_2.x86_64 35/37 Verifying : php-xml-8.3.21-1.el9.remi.x86_64 36/37 Verifying : php-xml-8.0.30-1.el9_2.x86_64 37/37 Upgraded: php-8.3.21-1.el9.remi.x86_64 php-cli-8.3.21-1.el9.remi.x86_64 php-common-8.3.21-1.el9.remi.x86_64 php-fpm-8.3.21-1.el9.remi.x86_64 php-gd-8.3.21-1.el9.remi.x86_64 php-mbstring-8.3.21-1.el9.remi.x86_64 php-mysqlnd-8.3.21-1.el9.remi.x86_64 php-opcache-8.3.21-1.el9.remi.x86_64 php-pdo-8.3.21-1.el9.remi.x86_64 php-xml-8.3.21-1.el9.remi.x86_64 Installed: capstone-4.0.2-10.el9.x86_64 fribidi-1.0.10-6.el9.2.x86_64 gd3php-2.3.3-9.el9.remi.x86_64 highway-1.2.0-2.el9.x86_64 jxl-pixbuf-loader-0.7.0-1.el9.x86_64 libaom-3.12.0-1.el9.x86_64 libavif-0.11.1-5.el9.x86_64 libdav1d-1.5.1-1.el9.x86_64 libimagequant-2.17.0-1.el9.x86_64 libjxl-0.7.0-1.el9.x86_64 libraqm-0.8.0-1.el9.x86_64 libsodium-1.0.18-8.el9.x86_64 libvmaf-2.3.0-2.el9.x86_64 oniguruma5php-6.9.10-1.el9.remi.x86_64 php-sodium-8.3.21-1.el9.remi.x86_64 rav1e-libs-0.7.1-3.el9.x86_64 svt-av1-libs-0.9.0-1.el9.x86_64 Complete!
PHP-FPM 설정
# sudo systemctl enable --now php-fpm
웹 서버 재 시작
# sudo systemctl restart httpd
설치된 PHP 버전 확인
# php -v PHP 8.3.21 (cli) (built: May 6 2025 13:58:10) (NTS gcc x86_64) Copyright (c) The PHP Group Zend Engine v4.3.21, Copyright (c) Zend Technologies with Zend OPcache v8.3.21, Copyright (c), by Zend Technologies
설치 후기
설치를 완료하고 나니 이전에 오류가 나는 소스에 오류가 없어 졌네요. PHP 8.0으로 업그레이드 되면서 PHP 엔진의 Parse가 엄격하게 문법을 검사하여 생겼다고 하는데 정확히는 알 수가 없다.
내가 보기에는 한글과 html 에서 조건 처리하는 부분일 것 같은데 공개된 소스가 아니고 내가 만든 코드다 보니 그냥 무시 하기로 했다.