Skip to main content


PHP projects can manage most of their dependencies locally with composer. Some PHP extensions, however, need to be bundled with PHP at compile time.

Example Repo

Open In

Adding PHP to your Project

Run devbox add php php80Packages.composer, or add the following to your devbox.json:

    "packages": [

This will install PHP 8.1 in your shell.

Other versions available include:

  • php80 (PHP 8.0)
  • php82 (PHP 8.2)

Installing PHP Extensions

You can compile additional extensions into PHP by adding them to packages in your devbox.json. Devbox will automatically ensure that your extensions are included in PHP at compile time.

For example -- to add the ds extension, run devbox add php81Extensions.ds, or update your packages to include the following:

    "packages": [

PHP Plugin Details

The PHP Plugin will provide the following configuration when you install a PHP runtime with devbox add


  • php-fpm

Use devbox services start|stop php-fpm to start PHP-FPM in the background.

Helper Files

  • {PROJECT_DIR}/devbox.d/php81/php-fpm.conf

You can modify this file to configure your PHP-FPM server

Environment Variables