Last week I got problem with my Wodpress Plugin, it said

This plugin requires the PHP version >= 5.4.0 , and a following list of PHP extensions to be enabled: cURL, XMLWriter, OpenSSL, HASH, DOM

Then I go to my VM using putty, try to install those PHP Extension, before I run ‘apt-get install …..’, I tried to check the PHP version

root@myVM:/home/users# php -v

The program ‘php’ is currently not installed. You can install it by typing:

apt-get install php5-cli

I was shocked.. where’s my PHP, my wordpress application.. then I realized that I’m choose WordPress + mysql with Docker Engine

So I tried to find how to enable the php extension in docker container. And this tutorial based on my question in MSDN Forum (https://social.msdn.microsoft.com/Forums/azure/en-US/244b8994-0596-443e-b755-1a47ead0c1cd/php-how-to-enable-php-extension?forum=windowsazurewebsitespreview) and I write down this blog to make easier to find the solution when I need it again.

Below is the steps

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`

5. run ‘apt-get install php-curl’ etc