1

Following example in How to install mcrypt on Docker I came to this:

name: myapp
  recipe: drupal7
  config:
    webroot: web
    php: '7.2'
proxy:
  pma:
    - pma.myapp.lndo.site
services:
  pma:
    type: phpmyadmin
appserver:
  extras:
    - "apt-get update -y"
    - "apt-get install libmcrypt-dev"
    - "pecl install mcrypt-1.0.1"
    - "docker-php-ext-enable mcrypt"

After rebuilding I see:

$ lando php -m | grep mcrypt
mcrypt

But in my web application when I look at the page with phpinfo(), then there is no trace of mcrypt. Please help me out to install php-mcrypt correctly.

ñull
  • 384
  • 3
  • 14
  • Possible duplicate of [Issue in installing php7.2-mcrypt](https://stackoverflow.com/questions/48275494/issue-in-installing-php7-2-mcrypt) – Dave Feb 18 '19 at 18:05
  • https://docs.devwithlando.io/tutorials/php.html#adding-or-removing-extensions `extras:` exchange `build_as_root:` – FAEWZX Feb 18 '19 at 18:12
  • Please note that it does install, but only for CLI. For Apache it still does not appear in phpinfo(); even when using build_as_root. I think that docker-php-ext-enable is at fault. Apparently it only enables it for CLI PHP. – ñull Feb 19 '19 at 13:15

2 Answers2

2

This is what you've missed:

services:
  appserver:
    build_as_root:
      - apt-get update -y
      - apt-get install libmcrypt-dev
      - pecl install mcrypt-1.0.1
      - docker-php-ext-enable mcrypt

You can use the following:

name: myapp
  recipe: drupal7
  config:
    webroot: web
    php: '7.2'
proxy:
  pma:
    - pma.myapp.lndo.site
services:
  pma:
    type: phpmyadmin
  appserver:
    build_as_root:
      - apt-get update -y
      - apt-get install libmcrypt-dev
      - pecl install mcrypt-1.0.1
      - docker-php-ext-enable mcrypt
Rishi Kulshreshtha
  • 1,083
  • 1
  • 17
  • 30
0

Made it work with:

services:
  appserver:
    build_as_root:
      - apt-get update -y
      - apt-get install -y libmcrypt-dev
      - pecl install mcrypt
      - docker-php-ext-enable mcrypt
Joao Ventura
  • 101
  • 3