none
[PHP][Azure Container Service] How to enable php extension

Answers

  • Hello Robby Gunawan S,

    You can refer to this link that show how to install PHP extensions to docker:

    https://github.com/docker-library/docs/tree/master/php

    Thanks,
    Syed Irfan Hussain

    Monday, December 14, 2015 1:09 PM
  • According to your error, you can check the php version and install these php extensions that the plugin require when you enter to the new shell in the container.

    In the shell of Docker Container, command `php -v` to check the version, and command `apt-get update` to update the source repository, command `apt-cache search <key word of software>` to seach the software name in the repository. When you install a software thru command `apt-get install <software package name>`, the tool `apt-get` will help installing all dependencies package, and you need to type `Y` to confirm the installation, or you can install thess php extensions thru compile and build from the extension source code.

    (These operations below in the shell of Linux VM contains Docker) If you are afraid to break the web apps on docker container, you can command `docker commit -m "<comment>" -a "<user info like 'Docker Newbee'>" <container id> <repository like 'owner/wordpress'>` to save a modified image from the exist container and get the modified image id. Then you can check it thru command `docker images`. And you can export the modified image to a tar file thru command `docker save -o <tar filename>.tar <REPOSITORY found by cmd 'docker image'>` and load the export tar file into image repository again thru command `docker load --input <tar filename>.tar`.

    Any concern, please feel free to let me know.

    Thursday, December 17, 2015 12:32 PM
    Moderator

All replies

  • Hello Robby Gunawan S,

    You can refer to this link that show how to install PHP extensions to docker:

    https://github.com/docker-library/docs/tree/master/php

    Thanks,
    Syed Irfan Hussain

    Monday, December 14, 2015 1:09 PM
  • Hi, I tried to reproduce the error to solve the issue.

    The process is that I created a `wordpress + mysql` container published by Docker on Azure new portal and access its public ip address to complete the wordpress installation, then moved to the wordpress `Plugins` page to search `Braintree Gateway` and successfully installed the plugin `WooCommerce Braintree Payment Gateway 1.1.0` searched without any errors.

    I don't know whether the plugin is that you need to install, but you can try to follow the steps below to remote the VM created for Docker and then enter into the `wordpress + mysql` container to install these extensions like doing on VM.

    The steps for entering Docker Container:
    1. Remote the VM for Docker, command `ssh <username>@<vm-host>`
    2. Get the container name of the `wordpress` container, command `docker ps` and find the NAME for the image `wordpress`
    3. Get the PID of the `wordpress` container, command `docker inspect -f "{{.State.Pid}}" <container-name>`
    4. Enter into the `wordpress` container, command `sudo nsenter --target <PID> --mount --uts --ipc --net --pid`

    Then you can do the installation for PHP extensions like on VM.
    Wednesday, December 16, 2015 1:02 PM
    Moderator
  • The steps for entering Docker Container:
    1. Remote the VM for Docker, command `ssh <username>@<vm-host>`
    2. Get the container name of the `wordpress` container, command `docker ps` and find the NAME for the image `wordpress`
    3. Get the PID of the `wordpress` container, command `docker inspect -f "{{.State.Pid}}" <container-name>`
    4. Enter into the `wordpress` container, command `sudo nsenter --target <PID> --mount --uts --ipc --net --pid`

    Then you can do the installation for PHP extensions like on VM.

    I've follow the steps, in the step 4, i'm entering to new shell, what should I do? just run 'apt-get instal.......'? I don't want break my production website, because last time i'm trying install new php extension using 'apt-get install....' it broke my web app

    When I tried to apt-get install php5-curl

     apt-get install php5-curl
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following extra packages will be installed:
      php5-common
    Suggested packages:
      php5-user-cache
    The following NEW packages will be installed:
      php5-common php5-curl
    0 upgraded, 2 newly installed, 0 to remove and 7 not upgraded.
    Need to get 497 kB of archives.
    After this operation, 1,362 kB of additional disk space will be used.
    Do you want to continue? [Y/n] n

    I'm affraid broke my web apps

    • Edited by Robby Gunawan S Wednesday, December 16, 2015 6:44 PM adding new info
    Wednesday, December 16, 2015 6:05 PM
  • According to your error, you can check the php version and install these php extensions that the plugin require when you enter to the new shell in the container.

    In the shell of Docker Container, command `php -v` to check the version, and command `apt-get update` to update the source repository, command `apt-cache search <key word of software>` to seach the software name in the repository. When you install a software thru command `apt-get install <software package name>`, the tool `apt-get` will help installing all dependencies package, and you need to type `Y` to confirm the installation, or you can install thess php extensions thru compile and build from the extension source code.

    (These operations below in the shell of Linux VM contains Docker) If you are afraid to break the web apps on docker container, you can command `docker commit -m "<comment>" -a "<user info like 'Docker Newbee'>" <container id> <repository like 'owner/wordpress'>` to save a modified image from the exist container and get the modified image id. Then you can check it thru command `docker images`. And you can export the modified image to a tar file thru command `docker save -o <tar filename>.tar <REPOSITORY found by cmd 'docker image'>` and load the export tar file into image repository again thru command `docker load --input <tar filename>.tar`.

    Any concern, please feel free to let me know.

    Thursday, December 17, 2015 12:32 PM
    Moderator