PHP Builder (@now/php)

The @now/php builder allows you to use any .php file.

Note: This builder will only include one PHP source file per Lambda. In the future, it will automatically include its dependencies via static analysis.

Whenever you want to use PHP.

Define a .php file:

<?php phpinfo(); ?>

And a now.json like:

{
  "version": 2,
  "builds": [
    { "src": "*.php", "use": "@now/php" }
  ]
}

After running now, you'll get a URL like this: https://php-deployment-7z9gyzb8j.now.sh/

The entrypoint file must be a .php source file.

All standard PHP variables like $_GET, $_POST are supported, with the exception of:

  • $_SESSION
  • $_FILES

PHP 7 is implemented via the go-php package and bundled as a Go binary.

To help keep cold boot times low, the maximum output bundle size for a PHP lambda is, by default, 10mb.

This limit is extendable up to 50mb.

Example maxLambdaSize configuration:
{
  "builds": [
    { "src": "*.php", "use": "@now/php", "config": { "maxLambdaSize": "15mb" } }
  ]
}