decorative image for blog on alpine linux images
April 6, 2023

Introducing Zend Alpine Linux PHP Images

PHP Development

The Zend by Perforce team is thrilled to announce the immediate availability of Zend Alpine Linux PHP images. The images, which are built using Alpine Linux 3.16, make it easy for teams using end of life PHP to take advantage of the security and performance benefits of Alpine Linux.

In this blog, I'll walk through a bit of background on Alpine Linux, why it's a popular distro for PHP teams, and how to get started with Zend Alpine Linux PHP images.

Back to top

What Is Alpine Linux?

Alpine Linux is a minimal-profile, security-focused Linux distribution commonly used in containerized environments.

Alpine Linux is an open source project with origins as a fork of the LEAF Project, which itself was a fork from the Linux Router Project (which hoped to create a Linux distro that could fit on a single floppy disk). In the time since inception, Alpine Linux has stayed true to its origins operating under the motto of  "small, simple, and secure."

Common tenets of building application containers are to keep the size of the image minimal, and to only install what is absolutely needed. These practices help reduce security risk, reduce storage size in you registries, and improve startup times (smaller images size take less time to pull, and generally less time to bootstrap).

The most minimal image in the container ecosystem is scratch. However, it requires you install absolutely everything you need in order to run and monitor a service, which can lead to a lot of extra work and maintenance.

Alpine Linux is a good middle ground. Built on top of busybox, it has a minimal configuration that largely meets the needs of security and performance concerns, and provides both a minimal package manager and library of packages that prevents you from needing to compile and install everything needed for your application or service.

Because of its performance and security benefits (which are two top concerns for PHP teams), Alpine Linux is a popular choice for PHP applications — especially container-based PHP applications.

Back to top

Download PHP Alpine Linux Images

Zend Alpine Linux PHP images are available for download from our container registry. Access today, and explore our other container OS options, via the link below.

Visit the Container Registry

Back to top

ZendPHP for Alpine Linux

We have provided ZendPHP to Alpine Linux 3.16 via a custom Alpine Linux package repository, and compiled our packages to mimic the official PHP packages provided by Alpine. We provide packages for both x86_64 and arm64 architectures.

Key differences from the standard Alpine Linux PHP packages include:

  • You can install multiple PHP versions in parallel.
  • We provide LTS editions of PHP.
  • We provide and maintain more extensions than the official Alpine Linux packages.
  • We provide ZendHQ in addition to ZendPHP.

While you can use Alpine as a minimal Linux distribution, the typical use case will be within containers. We provide ready-built ZendPHP containers for Alpine Linux 3.16, for each PHP version we support, and with CLI, php-fpm, and Apache versions for each. Like all ZendPHP images, you can use our build-argument customizable Dockerfile in order to streamline customization of your ZendPHP images.

Included in our ZendPHP repository for Alpine Linux is ZendHQ. All features present on other distributions are present in the Alpine Linux distribution as well.

Back to top

Installing ZendPHP in Alpine Linux

We recommend using the zendphpctl script for installing and managing ZendPHP on Alpine. The primary reason is that when using this script, automation you build will not need to change when you change operating systems or operating system versions. Additionally, we provide mechanisms in zendphpctl for handling authentication and authorization to the ZendPHP package repository that you would otherwise need to handle manually.

The typical workflow is:


zendphpctl repo install 
zendphpctl php install 8.1 
zendphpctl fpm install 
zendphpctl ext install ...

We provide instructions for manually installing ZendPHP on Alpine. These detail how to add the repository, steps needed for authentication/authorization with the repository, and how to install packages. We also detail how to compile non-standard or custom PHP extensions for the distribution.

Back to top

Zend Alpine Linux PHP Images for Docker

We provide Alpine Linux PHP images on cr.zend.com using the following name template: 

cr.zend.com/zendphp/{PHP_VERSION}:alpine-3.16-(cli|fpm|apache)(-arm64)

Like all our other images, they include s6-overlay, providing the ability to run services securely as non-root users, and to run multiple services in the same container. All images can be managed via the custom Dockerfile if desired. These image sizes are as much as 90% smaller than images for other operating systems we provide!

Back to top

Final Thoughts

Using ZendPHP with Alpine Linux gives PHP teams the full security and performance benefits of Alpine Linux as well as ability to work with fully-patched and supported EOL PHP versions. Add to that a broader selection of extensions, and you also get the benefit of added extensibility for your deployments.

If your team is deploying (or considering deploying) PHP with Alpine Linux, I highly encourage you to take our new Alpine Linux PHP images for a test drive. As mentioned earlier, these images can be as little as 10% of the size of our standard Linux images which can mean big cost savings wherever you may deploy.

Try ZendPHP for Free

Ready to see how ZendPHP works in your environment? Try ZendPHP free for 30 days via the link below.

Image Zend PHP Version Support Chart Comparison 02-2023 8.2

 

See Trial Details

Additional Resources

 

Back to top