• Dockerfile
#更改源
RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories \
  && apk update \
  && apk upgrade \
#更改时区
RUN apk --no-cache add tzdata \
   && cp "/usr/share/zoneinfo/Asia/Shanghai" /etc/localtime \
   && echo "Asia/Shanghai" > /etc/timezone
#安装mysql
RUN docker-php-ext-install pdo pdo_mysql mysqli \
#安装GD
  && apk add --no-cache libxpm libxpm-dev \
  && apk add --no-cache freetype freetype-dev libjpeg libpng libpng-dev libwebp-dev libjpeg-turbo-dev libmcrypt-dev  \
  && docker-php-ext-configure gd --with-gd --with-png-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-freetype-dir=/usr/include/ --with-xpm-dir=/usr/include/  \
  && docker-php-ext-install gd \
#安装zip zlib1g-dev
    && apk add --no-cache  libzip libzip-dev \
    && docker-php-ext-install zip

#安装gettext
RUN apk add --noe-cache gettext-dev \
  && docker-php-ext-install gettext

#安装redis
RUN curl -L -o /tmp/redis.tar https://pecl.php.net/get/redis-5.3.7.tgz \
  && cd /tmp/ \
  && tar -zxvf /tmp/redis.tar \
  && mkdir -p /usr/src/php/ext \
  && cp -r ./redis-5.3.7 /usr/src/php/ext/redis \
  && rm -rf ./redis-5.3.7 \
  && cd /usr/src/php/ext/redis \
  && docker-php-ext-install redis

#安装rabbitmq
RUN apk add --no-cache rabbitmq-c rabbitmq-c-dev \
  && curl -L -o /tmp/amqp.tar https://pecl.php.net/get/amqp-1.11.0.tgz \
  && cd /tmp/ \
  && tar -zxvf /tmp/amqp.tar \
  && cp -r ./amqp-1.11.0 /usr/src/php/ext/amqp \
  && rm -rf ./amqp-1.11.0 \
  && cd /usr/src/php/ext/amqp \
  && docker-php-ext-install amqp

#安装mongodb
RUN curl -L -o /tmp/mongodb.tar  https://pecl.php.net/get/mongodb-1.13.0.tgz \
  && cd /tmp/ \
  &&  tar -zxvf /tmp/mongodb.tar \
  &&  cp -r ./mongodb-1.13.0 /usr/src/php/ext/mongodb \
  &&  rm -rf ./mongodb-1.13.0  \
  &&  cd /usr/src/php/ext/mongodb  \
  &&  docker-php-ext-install mongodb

错误

#php7.4 zip模块安装报错
Package "libzip", required by "virtual:world", not found
因为libzip版本太高
降低源使用
RUN echo http://mirrors.aliyun.com/alpine/v3.13/main/ > /etc/apk/repositories \
  && echo http://mirrors.aliyun.com/alpine/v3.13/community/ >> /etc/apk/repositories \
查寻当前版本
apk search libzip #1.7.x版本 
卸载apk del libzip libzip-dev
重新安装

错误处理

*参考 https://www.jianshu.com/p/aa389c592821

错误: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution**
处理:
apk add --no-cache libxslt-devel

错误: error: Could not find net-snmp-config binary. Please check your net-snmp installation.**
处理:
apk add --no-cache net-snmp-devel

错误: error: Please reinstall readline - I cannot find readline.h**
处理:
apk add --no-cache readline-devel

错误: error: Cannot find pspell**
处理:
apk add --no-cache aspell-devel

**checking for unixODBC support... configure: error: ODBC header file '/usr/include/sqlext.h' not found!**
处理:
apk add --no-cache unixODBC-devel

错误: error: Unable to detect ICU prefix or /usr/bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works.**
处理:
apk add --no-cache libicu-devel

错误: error: utf8mime2text() has new signature, but U8TCANONICAL is missing. This should not happen. Check config.log for additional information.**
处理:
apk add --no-cache libc-client-devel

错误: error: freetype.h not found.**
处理:
apk add --no-cache freetype-devel

错误: error: xpm.h not found.**
处理:
apk add --no-cache libXpm-devel

错误: error: png.h not found.**
处理:
apk add --no-cache libpng-devel

错误: error: vpx_codec.h not found.**
处理:
apk add --no-cache libvpx-devel

错误: error: Cannot find enchant**
处理:
apk add --no-cache enchant-devel

错误: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/**
处理:
apk add --no-cache libcurl-devel

LAOGAO added 20140907:

错误: error: mcrypt.h not found. Please reinstall libmcrypt.**
处理:
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
tar zxf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure
make && make install

added 20141003:

**Cannot find imap**
处理:
ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so

错误: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing.**
处理:
apk add --no-cache libc-client-devel

**Cannot find ldap.h**
处理:
apk add --no-cache openldap
apk add --no-cache openldap-devel

错误: error: Cannot find ldap libraries in /usr/lib**
处理:
**cp -frp /usr/lib64/libldap* /usr/lib/**

错误: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path**
处理:
apk add --no-cache postgresql-devel

错误: error: Please reinstall the lib curl distribution**
处理:
apk add --no-cache curl-devel

错误: error: Could not find net-snmp-config binary. Please check your net-snmp installation.**
处理:
apk add --no-cache net-snmp-devel

错误: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution**
处理:
apk add --no-cache libxslt-devel

checking for BZip2 support… yes checking for BZip2 in default path… not found configure: error: Please reinstall the BZip2 distribution

Fix:
处理:
apk add --no-cache bzip2-devel

checking for cURL support… yes checking if we should use cURL for url streams… no checking for cURL in default path… not found configure: error: Please reinstall the libcurl distribution – easy.h should be in/include/curl/

Fix:
处理:
apk add --no-cache curl-devel

checking for curl_multi_strerror in -lcurl… yes checking for QDBM support… no checking for GDBM support… no checking for NDBM support… no configure: error: DBA: Could not find necessary header file(s).

Fix:
处理:
apk add --no-cache db4-devel

checking for fabsf… yes checking for floorf… yes configure: error: jpeglib.h not found.

Fix:
处理:
apk add --no-cache libjpeg-devel

checking for fabsf… yes checking for floorf… yes checking for jpeg_read_header in -ljpeg… yes configure: error: png.h not found.

Fix:
处理:
apk add --no-cache libpng-devel

checking for png_write_image in -lpng… yes If configure fails try –with-xpm-dir=

configure: error: freetype.h not found.
Fix:
处理:
Reconfigure your PHP with the following option. --with-xpm-dir=/usr

checking for png_write_image in -lpng… yes configure: error: libXpm.(a|so) not found.

Fix:
处理:
apk add --no-cache libXpm-devel

checking for bind_textdomain_codeset in -lc… yes checking for GNU MP support… yes configure: error: Unable to locate gmp.h

Fix:
处理:
apk add --no-cache gmp-devel

checking for utf8_mime2text signature… new checking for U8T_DECOMPOSE… configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

Fix:
处理:
apk add --no-cache libc-client-devel

checking for LDAP support… yes, shared checking for LDAP Cyrus SASL support… yes configure: error: Cannot find ldap.h

Fix:
处理:
apk add --no-cache openldap-devel

checking for mysql_set_character_set in -lmysqlclient… yes checking for mysql_stmt_next_result in -lmysqlclient… no checking for Oracle Database OCI8 support… no checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h' not found!

Fix:
处理:
apk add --no-cache unixODBC-devel

checking for PostgreSQL support for PDO… yes, shared checking for pg_config… not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

Fix:
处理:
apk add --no-cache postgresql-devel

checking for sqlite 3 support for PDO… yes, shared checking for PDO includes… (cached) /usr/local/src/php-5.3.7/ext checking for sqlite3 files in default path… not found configure: error: Please reinstall the sqlite3 distribution

Fix:
处理:
apk add --no-cache sqlite-devel

checking for utsname.domainname… yes checking for PSPELL support… yes configure: error: Cannot find pspell

Fix:
处理:
apk add --no-cache aspell-devel

checking whether to enable UCD SNMP hack… yes checking for default_store.h… no

checking for kstat_read in -lkstat… no checking for snmp_parse_oid in -lsnmp… no checking for init_snmp in -lsnmp… no configure: error: SNMP sanity check failed. Please check config.log for more information.

Fix:
处理:
apk add --no-cache net-snmp-devel

checking whether to enable XMLWriter support… yes, shared checking for xml2-config path… (cached) /usr/bin/xml2-config checking whether libxml build works… (cached) yes checking for XSL support… yes, shared configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

Fix:
处理:
apk add --no-cache libxslt-devel

configure: error: xml2-config not found. Please check your libxml2 installation.

Fix:
处理:
apk add --no-cache libxml2-devel

checking for PCRE headers location… configure: error: Could not find pcre.h in /usr

Fix:
处理:
apk add --no-cache pcre-devel

configure: error: Cannot find MySQL header files under yes. Note that the MySQL client library is not bundled anymore!

Fix:
处理:
apk add --no-cache mysql-devel

checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h' not found!

Fix:
处理:
apk add --no-cache unixODBC-devel

checking for pg_config… not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

Fix:
处理:
apk add --no-cache postgresql-devel

configure: error: Cannot find pspell

Fix:
处理:
apk add --no-cache pspell-devel

configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.

Fix:
处理:
apk add --no-cache net-snmp-devel

configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

Fix:
处理:
apk add --no-cache libxslt-devel

## [linux编译安装时常见错误解决办法](https://www.cnblogs.com/sweetXiaoma/p/5855732.html)

This article is post on https://coderwall.com/p/ggmpfa

原文链接:http://www.bkjia.com/PHPjc/1008013.html

错误: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution**
处理:
apk add --no-cache libxslt-devel

错误: error: Could not find net-snmp-config binary. Please check your net-snmp installation.**
处理:
apk add --no-cache net-snmp-devel

错误: error: Please reinstall readline - I cannot find readline.h**
处理:
apk add --no-cache readline-devel

错误: error: Cannot find pspell**
处理:
apk add --no-cache aspell-devel

**checking for unixODBC support... configure: error: ODBC header file '/usr/include/sqlext.h' not found!**
处理:
apk add --no-cache unixODBC-devel

错误: error: Unable to detect ICU prefix or /usr/bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works.**
处理:
apk add --no-cache libicu-devel

错误: error: utf8mime2text() has new signature, but U8TCANONICAL is missing. This should not happen. Check config.log for additional information.**
处理:
apk add --no-cache libc-client-devel

错误: error: freetype.h not found.**
处理:
apk add --no-cache freetype-devel

错误: error: xpm.h not found.**
处理:
apk add --no-cache libXpm-devel

错误: error: png.h not found.**
处理:
apk add --no-cache libpng-devel

错误: error: vpx_codec.h not found.**
处理:
apk add --no-cache libvpx-devel

错误: error: Cannot find enchant**
处理:
apk add --no-cache enchant-devel

错误: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/**
处理:
apk add --no-cache libcurl-devel

LAOGAO added 20140907:

错误: error: mcrypt.h not found. Please reinstall libmcrypt.**
处理:
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
tar zxf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure
make && make install

added 20141003:

**Cannot find imap**
处理:
ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so

错误: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing.**
处理:
apk add --no-cache libc-client-devel

**Cannot find ldap.h**
处理:
apk add --no-cache openldap
apk add --no-cache openldap-devel

错误: error: Cannot find ldap libraries in /usr/lib**
处理:
**cp -frp /usr/lib64/libldap* /usr/lib/**

错误: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path**
处理:
apk add --no-cache postgresql-devel

错误: error: Please reinstall the lib curl distribution**
处理:
apk add --no-cache curl-devel

错误: error: Could not find net-snmp-config binary. Please check your net-snmp installation.**
处理:
apk add --no-cache net-snmp-devel

错误: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution**
处理:
apk add --no-cache libxslt-devel

checking for BZip2 support… yes checking for BZip2 in default path… not found configure: error: Please reinstall the BZip2 distribution

Fix:
处理:
apk add --no-cache bzip2-devel

checking for cURL support… yes checking if we should use cURL for url streams… no checking for cURL in default path… not found configure: error: Please reinstall the libcurl distribution – easy.h should be in/include/curl/

Fix:
处理:
apk add --no-cache curl-devel

checking for curl_multi_strerror in -lcurl… yes checking for QDBM support… no checking for GDBM support… no checking for NDBM support… no configure: error: DBA: Could not find necessary header file(s).

Fix:
处理:
apk add --no-cache db4-devel

checking for fabsf… yes checking for floorf… yes configure: error: jpeglib.h not found.

Fix:
处理:
apk add --no-cache libjpeg-devel

checking for fabsf… yes checking for floorf… yes checking for jpeg_read_header in -ljpeg… yes configure: error: png.h not found.

Fix:
处理:
apk add --no-cache libpng-devel

checking for png_write_image in -lpng… yes If configure fails try –with-xpm-dir=

configure: error: freetype.h not found.
Fix:
处理:
Reconfigure your PHP with the following option. --with-xpm-dir=/usr

checking for png_write_image in -lpng… yes configure: error: libXpm.(a|so) not found.

Fix:
处理:
apk add --no-cache libXpm-devel

checking for bind_textdomain_codeset in -lc… yes checking for GNU MP support… yes configure: error: Unable to locate gmp.h

Fix:
处理:
apk add --no-cache gmp-devel

checking for utf8_mime2text signature… new checking for U8T_DECOMPOSE… configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

Fix:
处理:
apk add --no-cache libc-client-devel

checking for LDAP support… yes, shared checking for LDAP Cyrus SASL support… yes configure: error: Cannot find ldap.h

Fix:
处理:
apk add --no-cache openldap-devel

checking for mysql_set_character_set in -lmysqlclient… yes checking for mysql_stmt_next_result in -lmysqlclient… no checking for Oracle Database OCI8 support… no checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h' not found!

Fix:
处理:
apk add --no-cache unixODBC-devel

checking for PostgreSQL support for PDO… yes, shared checking for pg_config… not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

Fix:
处理:
apk add --no-cache postgresql-devel

checking for sqlite 3 support for PDO… yes, shared checking for PDO includes… (cached) /usr/local/src/php-5.3.7/ext checking for sqlite3 files in default path… not found configure: error: Please reinstall the sqlite3 distribution

Fix:
处理:
apk add --no-cache sqlite-devel

checking for utsname.domainname… yes checking for PSPELL support… yes configure: error: Cannot find pspell

Fix:
处理:
apk add --no-cache aspell-devel

checking whether to enable UCD SNMP hack… yes checking for default_store.h… no

checking for kstat_read in -lkstat… no checking for snmp_parse_oid in -lsnmp… no checking for init_snmp in -lsnmp… no configure: error: SNMP sanity check failed. Please check config.log for more information.

Fix:
处理:
apk add --no-cache net-snmp-devel

checking whether to enable XMLWriter support… yes, shared checking for xml2-config path… (cached) /usr/bin/xml2-config checking whether libxml build works… (cached) yes checking for XSL support… yes, shared configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

Fix:
处理:
apk add --no-cache libxslt-devel

configure: error: xml2-config not found. Please check your libxml2 installation.

Fix:
处理:
apk add --no-cache libxml2-devel

checking for PCRE headers location… configure: error: Could not find pcre.h in /usr

Fix:
处理:
apk add --no-cache pcre-devel

configure: error: Cannot find MySQL header files under yes. Note that the MySQL client library is not bundled anymore!

Fix:
处理:
apk add --no-cache mysql-devel

checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h' not found!

Fix:
处理:
apk add --no-cache unixODBC-devel

checking for pg_config… not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

Fix:
处理:
apk add --no-cache postgresql-devel

configure: error: Cannot find pspell
Fix:
处理:
apk add --no-cache pspell-devel

configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
Fix:
处理:
apk add --no-cache net-snmp-devel

error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
Fix:
处理:
apk add --no-cache libxslt-devel