OS/Linux

Ubuntu 20.04 : PHP zip 확장모듈 설치

파란크리스마스 2020. 11. 23. 23:01
728x90

출처

libzip 컴파일

bluesanta@Kubuntu:~$ wget https://libzip.org/download/libzip-1.7.3.tar.gz
bluesanta@Kubuntu:~$ tar xvfz libzip-1.7.3.tar.gz
bluesanta@Kubuntu:~$ cd libzip-1.7.3/
bluesanta@Kubuntu:~/libzip-1.7.3$ mkdir build
bluesanta@Kubuntu:~/libzip-1.7.3$ cd build
bluesanta@Kubuntu:~/libzip-1.7.3/build$ cmake ..
bluesanta@Kubuntu:~/libzip-1.7.3/build$ make
bluesanta@Kubuntu:~/libzip-1.7.3/build$ make test
bluesanta@Kubuntu:~/libzip-1.7.3/build$ sudo make install
 
... 생략 ...
 
-- Installing: /usr/local/bin/zipcmp
-- Set runtime path of "/usr/local/bin/zipcmp" to ""
-- Installing: /usr/local/bin/zipmerge
-- Set runtime path of "/usr/local/bin/zipmerge" to ""
-- Installing: /usr/local/bin/ziptool
-- Set runtime path of "/usr/local/bin/ziptool" to ""

php zip module 설치

bluesanta@Kubuntu:~$ wget https://pecl.php.net/get/zip-1.19.2.tgz
bluesanta@Kubuntu:~$ tar zxvf zip-1.19.2.tgz
bluesanta@Kubuntu:~$ cd zip-1.19.2/
bluesanta@Kubuntu:~/zip-1.19.2$ /bluesanta/apps/php-7.4.12/bin/phpize
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
bluesanta@Kubuntu:~/zip-1.19.2$ ./configure  --prefix=/bluesanta/apps/php-7.4.12 --with-php-config=/bluesanta/apps/php-7.4.12/bin/php-config
bluesanta@Kubuntu:~/zip-1.15.2$ make && make test
bluesanta@Kubuntu:~/zip-1.19.2$ make install
Installing shared extensions:     /bluesanta/apps/php-7.4.12/lib/php/extensions/no-debug-zts-20190902/

/bluesanta/apps/php-7.4.12/php.ini 내용 추가

bluesanta@Kubuntu:~$ vi /bluesanta/apps/php-7.4.12/php.ini

[zip]
extension_dir=/bluesanta/apps/php-7.4.12/lib/php/extensions/no-debug-zts-20190902/
extension=zip.so