728x90
dockerfile docker-php-ext-install, docker-php-ext-enable, docker-php-ext-configure 명령
php 8.1 도커 컨테이너 실행
docker run -it --rm php:8.1-fpm bash
php 8.1 컨테이너에 설치되어 있는 기본 모듈
root@894e0cb82f31:/var/www/html# php -m
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
docker-php-ext-install 명령
docker-php-ext-install
usage: /usr/local/bin/docker-php-ext-install [-jN] [--ini-name file.ini] ext-name [ext-name ...]
ie: /usr/local/bin/docker-php-ext-install gd mysqli
/usr/local/bin/docker-php-ext-install pdo pdo_mysql
/usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop
if custom ./configure arguments are necessary, see docker-php-ext-configure
Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dl_test dom enchant exif ffi fileinfo filter ftp gd gettext gmp hash iconv imap intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlwriter xsl zend_test zip
Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.
pdo_mysql 모듈 추가
docker-php-ext-install pdo_mysql
root@894e0cb82f31:/var/www/html# docker-php-ext-install pdo_mysql
Configuring for:
PHP Api Version: 20210902
Zend Module Api No: 20210902
Zend Extension Api No: 420210902
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
...
cp ./.libs/pdo_mysql.lai /usr/src/php/ext/pdo_mysql/modules/pdo_mysql.la
PATH="$PATH:/sbin" ldconfig -n /usr/src/php/ext/pdo_mysql/modules
----------------------------------------------------------------------
Libraries have been installed in:
/usr/src/php/ext/pdo_mysql/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
+ strip --strip-all modules/pdo_mysql.so
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20210902/
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o -o -name \*.dep | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la modules/* libs/*
rm -f ext/opcache/jit/zend_jit_x86.c
rm -f ext/opcache/jit/zend_jit_arm64.c
확인 모듈 확인
root@894e0cb82f31:/var/www/html# php -m | grep -i pdo
PDO
pdo_mysql
pdo_sqlite
docker-php-ext-enable 명령
docker-php-ext-enable
usage: /usr/local/bin/docker-php-ext-enable [options] module-name [module-name ...]
ie: /usr/local/bin/docker-php-ext-enable gd mysqli
/usr/local/bin/docker-php-ext-enable pdo pdo_mysql
/usr/local/bin/docker-php-ext-enable --ini-name 0-apc.ini apcu apc
Possible values for module-name:
opcache.so pdo_mysql.so sodium.so
Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.
pecl install redis
root@894e0cb82f31:/var/www/html# pecl install redis
downloading redis-5.3.7.tgz ...
Starting to download redis-5.3.7.tgz (275,200 bytes)
.........................................................done: 275,200 bytes
31 source files, building
running: phpize
Configuring for:
PHP Api Version: 20210902
Zend Module Api No: 20210902
Zend Extension Api No: 420210902
enable igbinary serializer support? [no] :
enable lzf compression support? [no] :
enable zstd compression support? [no] :
building in /tmp/pear/temp/pear-build-defaultuserJ24fXc/redis-5.3.7
running: /tmp/pear/temp/redis/configure --with-php-config=/usr/local/bin/php-config --enable-redis-igbinary=no --enable-redis-lzf=no --enable-redis-zstd=no
checking for grep that handles long lines and -e... /bin/grep
...
/bin/bash /tmp/pear/temp/pear-build-defaultuserJ24fXc/redis-5.3.7/libtool --mode=install cp ./redis.la /tmp/pear/temp/pear-build-defaultuserJ24fXc/redis-5.3.7/modules
cp ./.libs/redis.so /tmp/pear/temp/pear-build-defaultuserJ24fXc/redis-5.3.7/modules/redis.so
cp ./.libs/redis.lai /tmp/pear/temp/pear-build-defaultuserJ24fXc/redis-5.3.7/modules/redis.la
PATH="$PATH:/sbin" ldconfig -n /tmp/pear/temp/pear-build-defaultuserJ24fXc/redis-5.3.7/modules
----------------------------------------------------------------------
Libraries have been installed in:
/tmp/pear/temp/pear-build-defaultuserJ24fXc/redis-5.3.7/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-defaultuserJ24fXc/install-redis-5.3.7" install
Installing shared extensions: /tmp/pear/temp/pear-build-defaultuserJ24fXc/install-redis-5.3.7/usr/local/lib/php/extensions/no-debug-non-zts-20210902/
running: find "/tmp/pear/temp/pear-build-defaultuserJ24fXc/install-redis-5.3.7" | xargs ls -dils
3670167 4 drwxr-xr-x 3 root root 4096 Jun 13 00:42 /tmp/pear/temp/pear-build-defaultuserJ24fXc/install-redis-5.3.7
3670219 4 drwxr-xr-x 3 root root 4096 Jun 13 00:42 /tmp/pear/temp/pear-build-defaultuserJ24fXc/install-redis-5.3.7/usr
3670220 4 drwxr-xr-x 3 root root 4096 Jun 13 00:42 /tmp/pear/temp/pear-build-defaultuserJ24fXc/install-redis-5.3.7/usr/local
3670221 4 drwxr-xr-x 3 root root 4096 Jun 13 00:42 /tmp/pear/temp/pear-build-defaultuserJ24fXc/install-redis-5.3.7/usr/local/lib
3670222 4 drwxr-xr-x 3 root root 4096 Jun 13 00:42 /tmp/pear/temp/pear-build-defaultuserJ24fXc/install-redis-5.3.7/usr/local/lib/php
3670223 4 drwxr-xr-x 3 root root 4096 Jun 13 00:42 /tmp/pear/temp/pear-build-defaultuserJ24fXc/install-redis-5.3.7/usr/local/lib/php/extensions
3670224 4 drwxr-xr-x 2 root root 4096 Jun 13 00:42 /tmp/pear/temp/pear-build-defaultuserJ24fXc/install-redis-5.3.7/usr/local/lib/php/extensions/no-debug-non-zts-20210902
3670218 3544 -rwxr-xr-x 1 root root 3627792 Jun 13 00:42 /tmp/pear/temp/pear-build-defaultuserJ24fXc/install-redis-5.3.7/usr/local/lib/php/extensions/no-debug-non-zts-20210902/redis.so
Build process completed successfully
Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20210902/redis.so'
install ok: channel://pecl.php.net/redis-5.3.7
configuration option "php_ini" is not set to php.ini location
You should add "extension=redis.so" to php.ini
docker-php-ext-enable redis
root@894e0cb82f31:/var/www/html# php -m | egrep -i 'pdo|redis'
PDO
pdo_mysql
pdo_sqlite
redis
docker-php-ext-configure 명령
docker-php-ext-configure
usage: /usr/local/bin/docker-php-ext-configure ext-name [configure flags]
ie: /usr/local/bin/docker-php-ext-configure gd --with-jpeg-dir=/usr/local/something
Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dl_test dom enchant exif ffi fileinfo filter ftp gd gettext gmp hash iconv imap intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlwriter xsl zend_test zip
Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.
docker-php-ext-configure gd --with-freetype --with-jpeg
root@894e0cb82f31:/var/www/html# docker-php-ext-configure gd --with-freetype --with-jpeg
Configuring for:
PHP Api Version: 20210902
Zend Module Api No: 20210902
Zend Extension Api No: 420210902
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
...
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
docker-php-ext-install -j$(nproc) gd
root@894e0cb82f31:/var/www/html# docker-php-ext-install -j$(nproc) gd
/bin/bash /usr/src/php/ext/gd/libtool --mode=compile cc -I. -I/usr/src/php/ext/gd -I/usr/src/php/ext/gd/include -I/usr/src/php/ext/gd/main -I/usr/src/php/ext/gd -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/include/libpng16 -I/usr/include/freetype2 -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/src/php/ext/gd/libgd -DZEND_COMPILE_DL_EXT=1 -c /usr/src/php/ext/gd/gd.c -o gd.lo -MMD -MF gd.dep -MT gd.lo
...
cp ./.libs/gd.so /usr/src/php/ext/gd/modules/gd.so
cp ./.libs/gd.lai /usr/src/php/ext/gd/modules/gd.la
PATH="$PATH:/sbin" ldconfig -n /usr/src/php/ext/gd/modules
----------------------------------------------------------------------
Libraries have been installed in:
/usr/src/php/ext/gd/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
+ strip --strip-all modules/gd.so
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20210902/
Installing header files: /usr/local/include/php/
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o -o -name \*.dep | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la modules/* libs/*
rm -f ext/opcache/jit/zend_jit_x86.c
rm -f ext/opcache/jit/zend_jit_arm64.c
root@894e0cb82f31:/var/www/html# php -m | egrep -i 'pdo|redis|gd'
gd
PDO
pdo_mysql
pdo_sqlite
redis
728x90
'리눅스' 카테고리의 다른 글
[리눅스] ubuntu "Could not get lock" APT 오류 (0) | 2022.06.22 |
---|---|
[리눅스] PHP zip 확장(Extension) 모듈 설치 (0) | 2022.06.15 |
mongodb와 mongo-express를 Docker Compose를 사용하여 실행하는 방법 (0) | 2022.06.09 |
[리눅스] mongodb secondary show dbs 에러 (0) | 2022.06.08 |
[리눅스] 애플 맥북 실리콘 M1에서 도커 빌드시 오류 (0) | 2022.06.07 |