My problem: When i run command
docker build –no-cache -t php –progress=plain .
My container is building, but I get Error in my PHP-project:
Error Call to undefined function snmp2_real_walk()
Command install in Dockerfile is’t work… I need help!!
My Dockerfile:
FROM php:7.4-apache
# Use the default production configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
RUN if command -v a2enmod >/dev/null 2>&1; then
a2enmod rewrite headers
;fi
RUN apt-get update
# Install tools required for build stage
RUN apt-get install -fyqq
bash curl wget rsync ca-certificates openssl ssh git tzdata openntpd
libxrender1 fontconfig libc6
mariadb-client gnupg binutils-gold autoconf
g++ gcc gnupg libgcc1 linux-headers-amd64 make python
#RUN apt install -y libsnmp-dev
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
&& chmod 755 /usr/bin/composer
# Install additional PHP libraries
RUN docker-php-ext-install bcmath pdo_mysql
RUN
apt-get update &&
apt-get install libldap2-dev -y &&
rm -rf /var/lib/apt/lists/* &&
docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ &&
docker-php-ext-install ldap
# Install libraries for compiling GD, then build it
RUN apt-get update && apt-get install -y
libfreetype6
libfreetype6-dev
libjpeg62-turbo
libjpeg62-turbo-dev
libsqlite3-dev
libssl-dev
libpng-dev
libpng16-16
libcurl3-dev
libxml2-dev
libonig-dev
libsnmp-dev
snmp
&& docker-php-ext-install mysqli xmlrpc
&& docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/
&& docker-php-ext-install gd
&& apt-get remove -fyqq libfreetype6-dev libpng-dev libjpeg62-turbo-dev
# -------------------- Installing PHP Extension: snmp --------------------
RUN docker-php-ext-configure snmp --with-snmp
# Installation
&& docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) snmp
&& true
RUN sed -i 's/;extension=snmp/extension=snmp/' php.ini-production
# Add ZIP archives support
RUN apt-get install -fyqq zip libzip-dev
&& docker-php-ext-install zip
&& apt-get remove -fyqq libzip-dev
# Install xdebug
RUN pecl install xdebug
&& docker-php-ext-enable xdebug
# Enable XDebug
ADD xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
WORKDIR /app
I’ve tried a lot of options. Editing the
php.ini-production
file did not lead to the expected result. At the same time, the php.ini file also does not exist, but the command is present…