yeswework / fabrica-dev-kit

A toolkit for faster, smoother WordPress 5 development
https://fabri.ca/
MIT License
274 stars 27 forks source link

Is there a preferred way to add a PHP extension to docker? #21

Closed zomars closed 7 years ago

zomars commented 7 years ago

I've tried modifying the Dockerfile but no apparent changes are showing up.

zomars commented 7 years ago

To be precise I'm trying to install the intl extension so I can use the NumberFormatter class. Sorry If this is not the place to ask this, but I've already tried reading all docker docs, but the way FDK runs docker it's a little bit confusing for a newcomer like myself.

tiojoca commented 7 years ago

Have you tried running PECL on the container shell after the project has been set up?

zomars commented 7 years ago

@tiojoca care to give an example?

tiojoca commented 7 years ago

In general you can just start the shell with root user and run pecl install there:

docker-compose exec --user root wp /bin/bash
pecl install <package-name>

It seems for intl it is better to use apt-get instead however:

docker-compose exec --user root wp /bin/bash
sudo apt-get update
sudo apt-get install php5-intl

You might have to restart the WP container afterwards for the changes to take effect.