1. 기존 php config 설치 파일 백업
[root@~/src]# mv /root/src/php-7.4.9 /root/src/php-7.4.9_bak

2. apache, mysql 중지
[root@~]# /opt/apache/bin/apachectl stop
[root@~]# /opt/mysql/support-files/mysql.server stop
Shutting down MariaDB. SUCCESS!

[root@~]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1555/sshd           
tcp6       0      0 :::22                   :::*                    LISTEN      1555/ssh

3. 기존 php 디렉토리 백업 완료
[root@~]# mv /opt/php /opt/php_bak

4. 기존 apache libphp7.so 파일 백업
[root@qs211-0124 /opt/apache/modules]# mv libphp7.so libphp7.so_bak

5. php 재컴파일

[root@~/src]# cd /root/src; tar -zxvf php-7.4.9.tar.gz; cd php-7.4.9

ㄴ 아래 내용은 php-7.4.9 먼저 tar로 풀고 진행하자
ㄴ 아래 컴파일 진행할때 libzip이 안될수도 있다. 
ㄴ 에러 내용 : configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:
                       No package 'libzip' found
ㄴ 해결법 : libzip 설치 후 export 해야한다.
wget -P /root/src --no-check-certificate https://libzip.org/download/libzip-1.8.0.tar.gz
cd /root/src; tar -xvf libzip-1.8.0.tar.gz; cd libzip-1.8.0
cmake3 -DCMAKE_INSTALL_PREFIX=/usr/local/libzip-1.8.0
make -j 4
make install -j 4

export PKG_CONFIG_PATH=/usr/local/libzip-1.8.0/lib64/pkgconfig


./configure \
--prefix=/opt/php \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-apxs2=/opt/apache/bin/apxs \
--with-curl \
--with-jpeg=/usr \
--with-freetype=/usr \
--with-png-dir=/usr \
--with-xpm=/usr \
--with-zlib \
--with-zlib-dir=/usr \
--with-gdbm \
--with-gettext \
--with-iconv \
--with-openssl \
--with-libxml=/usr/lib \
--with-bz2 \
--with-zip \
--enable-gd \
--enable-exif \
--enable-ftp \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg \
--enable-soap \
--enable-mbstring=all \
--enable-bcmath

*실행결과
Thank you for using PHP.
configure: WARNING: unrecognized options: --with-png, --with-xpm-dir, --with-libxml-dir, --enable-zip

make -j `grep processor /proc/cpuinfo | wc -l`; make install

6. php.ini 파일 복사
cp -f /opt/php_bak/lib/php.ini /opt/php/lib/php.ini

7. apache, mysql 시작
[root@~]# /opt/apache/bin/apachectl configtest
Syntax OK
[root@~]# /opt/apache/bin/apachectl start
[root@~]# /opt/mysql/support-files/mysql.server start
Starting MariaDB.211201 14:55:35 mysqld_safe Logging to '/home/mysql/var/qs211-0124.cafe24.com.err'.
211201 14:55:35 mysqld_safe Starting mariadbd daemon with databases from /home/mysql/var
SUCCESS!

8. 모듈 추가 확인 확인
[root@~]# php -m | grep gd
gd

9. png, jpeg, gd 라이브러리 활성화 확인
ㄴ PNG 는 php 7.4 에서는 기본 포함

[root@~]# php -r 'print_r(gd_info());'
Array
(
    [GD Version] => bundled (2.1.0 compatible)
    [FreeType Support] => 1
    [FreeType Linkage] => with freetype
    [GIF Read Support] => 1
    [GIF Create Support] => 1
    [JPEG Support] => 1
    [PNG Support] => 1
    [WBMP Support] => 1
    [XPM Support] => 1
    [XBM Support] => 1
    [WebP Support] =>
    [BMP Support] => 1
    [TGA Read Support] => 1
    [JIS-mapped Japanese Font Support] =>

ㄴ jpeg, png 모두 1로 활성화 되어있는것이다!!

'On-premise > php' 카테고리의 다른 글

PHP 5.3.3 소스 설치 (MySQL 5.1)  (0) 2023.11.07
php 8.1 설치  (0) 2023.11.07
라이믹스(Rhymix 설치)  (0) 2023.11.07
php 7.4 옵션 변경  (0) 2023.11.07
php 5.6 설치 ( curl 특정 경로 지정하여 설치)  (0) 2023.11.07

+ Recent posts