Skip to content
This repository has been archived by the owner on Mar 13, 2019. It is now read-only.

mcrypt Extension not loaded although installed #16

Closed
cbeier opened this issue May 25, 2015 · 12 comments
Closed

mcrypt Extension not loaded although installed #16

cbeier opened this issue May 25, 2015 · 12 comments

Comments

@cbeier
Copy link

cbeier commented May 25, 2015

I use the standard composer/composer build. It seems that the extension is installed and loaded. But in the phpinfo() the extension is not loaded / listed.

So if I install laravel via my composer container I get a error that the mcrypt extension is missing.

Output php -m:

[PHP Modules]
Core
ctype
curl
date
dom
ereg
fileinfo
filter
hash
iconv
json
libxml
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
readline
recode
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]

Dockerfile:

# Composer Docker Container
FROM php:5.6-cli
MAINTAINER Rob Loach <robloach@gmail.com>

ENV DEBIAN_FRONTEND noninteractive

# Dependencies
RUN echo "deb http://packages.dotdeb.org wheezy all" >> /etc/apt/sources.list
RUN echo "deb-src http://packages.dotdeb.org wheezy all" >> /etc/apt/sources.list
RUN curl http://www.dotdeb.org/dotdeb.gpg | apt-key add -
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y zlib1g zlib1g-dev php5-common git mercurial subversion
RUN apt-get install -y php5-curl php5-gd php5-json php5-mcrypt php5-mysql php5-pgsql php5-readline php5-sqlite sqlite3 mysql-client php5-mysql mcrypt php-pear

# Enable any modules
RUN php5enmod curl json mysql mysqli pdo_mysql pdo_sqlite readline gd mcrypt pdo sqlite3
RUN pecl install zip
RUN echo "extension=zip.so" > /usr/local/etc/php/conf.d/extension-zip.ini

# Set memory limit
RUN echo "memory_limit=1024M" > /usr/local/etc/php/conf.d/memory-limit.ini

# Set environmental variables
ENV COMPOSER_HOME /root/composer

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=1.0.0-alpha8

# Display version information
RUN php --version
RUN composer --version

# Set up the application directory.
VOLUME ["/app"]
WORKDIR /app

# Set up the command arguments
CMD ["-"]
ENTRYPOINT ["composer", "--ansi"]
@RobLoach
Copy link
Owner

Interesting. Does a follow-up php5enmod mcrypt do anything?

@cbeier
Copy link
Author

cbeier commented May 25, 2015

No, that does nothing.

I think the problem comes from the base php:5.6-cli image. If I build a Dockerfile from scratch, then the mcrypt extension is loaded.

Dockerfile:

FROM debian:jessie

RUN apt-get update -y
RUN apt-get install -y php5-cli php5-dev php5-json curl git-core
RUN apt-get install -y zlib1g zlib1g-dev php5-common mcrypt
RUN apt-get install -y php5-curl php5-mcrypt php5-readline php-pear

RUN php5enmod curl json readline mcrypt pdo
RUN pecl install zip

# Set memory limit.
RUN echo "memory_limit=1024M" > /etc/php5/cli/conf.d/memory-limit.ini

RUN curl -sS https://getcomposer.org/installer | php

# Set up the command arguments
CMD ["-"]
ENTRYPOINT ["/composer.phar", "--ansi"]

Loaded modules:

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
mcrypt
mhash
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

@RobLoach
Copy link
Owner

Think we should ditch php:5.6-cli?

@cbeier
Copy link
Author

cbeier commented May 25, 2015

Unfortunately, I do not know exactly what causing the problem inside the php image. But inside the php:5.6-cli image are some things adjusted (paths, compile options, ...) which deviate from the standard PHP installation on Debian.

@RobLoach
Copy link
Owner

RobLoach commented Jun 8, 2015

@cbeier Is there another PHP-CLI Docker Container that you would recommend we use?

@cbeier
Copy link
Author

cbeier commented Jun 8, 2015

@RobLoach I have forked the container from ubermuda and customized (added necessary php extensions). My fork on github: https://github.com/cbeier/docker-composer and on docker: https://registry.hub.docker.com/u/cbeier/composer/

I currently know of no other php-cli container. Most container include php-cli with the used command line app.

@boedy
Copy link

boedy commented Jun 11, 2015

I have the same problem with mcrypt. Now using your fork @cbeier .

@RobLoach
Copy link
Owner

Opened up a PR for this: #18

@boedy
Copy link

boedy commented Jun 15, 2015

I think you should have used docker-php-ext-install for mcrypt

Something like this works for me (I probably also install some libraries which you don't need though. these you can leave out):

FROM php:5.6-cli

#update repo

RUN apt-get update && apt-get install -y \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng12-dev \
        libbz2-dev \
        php-pear \
        curl \
        git \
    && docker-php-ext-install iconv mcrypt \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd

#Download dependencies

# Set memory limit
RUN echo "memory_limit=1024M" > /usr/local/etc/php/conf.d/memory-limit.ini

# Set environmental variables
ENV COMPOSER_HOME /root/composer

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

RUN docker-php-ext-install \
    zip \
    bz2 \
    iconv \
    mcrypt \
    mbstring

# Set up the application directory.
VOLUME ["/app"]
WORKDIR /app

# Set up the command arguments
CMD ["-"]
ENTRYPOINT ["composer", "--ansi"]

@L0rD59
Copy link

L0rD59 commented Mar 14, 2016

Hi,

I've similar issue with the mbstring extension see details here : https://bugs.php.net/bug.php?id=71181

@sylus
Copy link
Contributor

sylus commented May 16, 2016

I can't reproduce this anymore on a recent docker pull is this issue still present?

@RobLoach
Copy link
Owner

Going to close this for now. Feel free to open up a new issue if it persists.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants