How do I install PHP extensions from the Wordpress Kubernetes Marketplace app?

Posted April 14, 2020 3.4k views

So far I’ve been able to set up a Kubernetes cluster with the Wordpress Kubernetes app. It comes with a load balancer, droplet pool, and some volumes. After getting it set up, I was able to switch to the wordpress namespace with kubectl.

kubectl config set-context --current --namespace=wordpress

Then I executed bash on the wordpress pod.

kubectl exec -it wordpress-pod-name -- /bin/bash

So I did some exploring and found that the bitnami installation for wordpress is in /opt/bitnami and /bitnami has wp-content in it for some reason. On bitnami’s documentation, you can use a script called to restart the Apache and PHP services.

Install Different PHP Modules

Strangely enough, this script does’t exist and I can’t find it. I tried restarting Apache and PHP the usual ways and those didn’t work either. I wanted to start by installing either ImageMagick or GD for PHP, but without being able to restart the services I’m stuck.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi, I recommend simply doing one of the following to get your required PHP modules installed

1). automated option

  a) locally create php.ini which has all PHP modules you require
  b) add a line to the Dockerfile to copy the php.ini into the appropriate directory within your running container
  c) kubectl apply -f your_resource_file.yml

2). manual option

  kubectl exec -it wordpress-pod-name -- sudo pecl install extension1 extension2 ... extensionN

In general, you should be able to restart any process. For example, one can restart Apache by doing something like the following depending on your setup:

  kubectl exec -it wordpress-pod-name -- sudo apachectl graceful

Well, I wish that the information assists you and best of luck.

Think different and code well,


  • So going with the manual option there, I found that pecl isn’t in my PATH. It’s located at /opt/bitnami/php/bin/pecl. Same things with Apache, it’s at /opt/bitnami/apache/bin/apachectl Furthermore, GD isn’t part of the pecl repo. You can try installing it like apt install php7.0-gd, but this will install an entirely separate install of PHP7 which I don’t think is the way to go here.

    Really appreciate you jumping on this. This is definitely something I need to learn more about. Especially working with yml files. Do you just write up those configs in a text editor?

    • At this time, I’m using a simple text editor like VSCode to craft YAML files. Once you become comfortable with the manual process, I recommend taking a look at the (1) option.

      Think different and code well,