1. php 7.4 소스 다운로드

wget https://www.php.net/distributions/php-7.4.22.tar.gz

2. 압축 해제 및 설치에 필요한 패키지 추가 설치 및 configure 에러 보완 전처리

yum -y install sqlite-devel oniguruma-devel
ln -s /usr/lib64/libgdbm_compat.so /usr/lib/libdbm.so

[에러발생]
checking for libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0… no

configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:

No package 'libzip' found

No package 'libzip' found
No package 'libzip' found

yum 으로 설되는 libzip libzip-devel 패키지의 버전이 요구 버전 보다 낮아서 libzip 을 compile 설치 해야 함.

그러나 libzip 을 cmake 하기 위해서 또 필요한 cmake 버전이 낮아서 cmake도 컴파일로 설치를 해야 함.
 
   - libzip 필요 CMake 버전 관련 에러 메세지
    CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
    CMake 3.0.2 or higher is required. You are running version 2.8.12.2

[Cmake 상위버전 컴파일]

https://github.com/Kitware/CMake/releases 에서 설치하고자 하는 버전을 찾아 소스를 다운로드

작성글의경우 cmake-3.21.1 를 사용함.

wget https://github.com/Kitware/CMake/releases/download/v3.21.1/cmake-3.21.1.tar.gz

tar zxvf cmake-3.21.1.tar.gz
cd cmake-3.21.1
./configure --prefix=/usr/local/cmake-3.21.1
make && make install
ln -s /usr/local/cmake-3.21.1 /usr/local/cmake

[libzip 1.7.3 버전 컴파일]

wget https://libzip.org/download/libzip-1.7.3.tar.gz

tar zxvf libzip-1.7.3.tar.gz
cd libzip-1.7.3
/usr/local/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local/libzip-1.7.3
make && make install
ln -s /usr/local/libzip-1.7.3 /usr/local/libzip
export PKG_CONFIG_PATH=/usr/local/libzip/lib64/pkgconfig (PHP가 컴파일 진행중인 창에서 실행할 것)

 

3. php 7.4 컴파일 진행

./configure --prefix=/usr/local/php-7.4.22 --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/etc/httpd/conf --with-iconv --with-gdbm=/usr --with-zlib=/usr --with-openssl --with-kerberos=/usr --with-imap-ssl=/usr --with-jpeg --with-png --with-zlib-dir=/usr --with-xpm --with-freetype --with-pic --with-curl --with-dbm --enable-gd --disable-libtool-lock --disable-short-tags --disable-debug --disable-ipv6 --enable-inline-optimization --enable-fast-install --enable-calendar --enable-ftp --enable-sockets --enable-gd-jis-conv --enable-dba=shared --enable-exif --with-zip --enable-mbstring --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-bcmath --enable-shmop --enable-soap --enable-xml --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libdir=lib64

make && make install

ln -s /usr/local/php-7.4.22 /usr/local/php

[PHP 7.4 에서 변경되거나 사라진 컴파일 옵션]
--enable-zip  → --with-zip
--with-gd → --enable-gd
--with-jpeg-dir → -with-jpeg
--with-libxml-dir → --with-libxml
--with-png-dir → --with-png
--with-freetype-dir → --with-freetype

--with-png (옵션없음 제외)

 

[참고 자료]

https://hoing.io/archives/3844
https://manvscloud.com/?tag=php8-%EC%84%A4%EC%B9%98

'Works > 설치매뉴얼' 카테고리의 다른 글

Apache에 mod_cband 설치  (0) 2016.06.24
PHP 속도 향상을 위한 eAccelerator 설치  (0) 2016.03.18
JDK(java) & tomcat 설치 총정리  (0) 2016.01.11
php pdo-mysql 확장 모듈 설치  (0) 2015.10.28
Apache 에 GeoIP 모듈설치  (0) 2015.10.28