Customization

Installing PHP extensions

Every image includes install-php-extensions, which installs an extension and the system packages it needs on both Debian and Alpine. Run it in your Dockerfile as root.

Add extensions in your Dockerfile

The images run as the unprivileged www-data user, so switch to root to install and switch back afterward:

Dockerfile
FROM serversideup/php:8.5-fpm-nginx

USER root
RUN install-php-extensions intl bcmath
USER www-data

Build and start the container. --build rebuilds the image when the Dockerfile changes:

Terminal
docker compose up --build

Check that the extensions loaded:

Terminal
docker compose exec php php -m | grep -E 'intl|bcmath'

To build your code into the same image for production, see packaging your app for deployment.

Which extensions you can install

install-php-extensions supports most PECL and bundled extensions across PHP versions. See its list of supported extensions. The extensions already in each image are on the default configurations page.

intl is a common addition. It isn't included by default because of its size, but Laravel's email validation rule needs it for the dns and spoof checks.

Can't find the extension you need? Ask in GitHub Discussions.