Configure PHP

The PHP engine exposes configuration options through the boxfile.yml.

Runtime

Specifies which PHP runtime and version to use. The following runtimes are available:

  • php-5.3
  • php-5.4
  • php-5.5
  • php-5.6
  • php-7.0 (default)
  • php-7.1
  • php-7.2
run.config:
  engine.config:
    runtime: php-7.0

PHP Configuration

short_open_tag

Sets the short_open_tag PHP setting.

run.config:
  engine.config:
    short_open_tag: true

zlib_output_compression

Sets the zlib.output_compression PHP setting.

run.config:
  engine.config:
    zlib_output_compression: 'Off'

allow_url_fopen

Sets the allow_url_fopen PHP setting.

run.config:
  engine.config:
    allow_url_fopen: 'On'

disable_functions

Sets the disable_fuctions PHP setting.

run.config:
  engine.config:
    disable_functions:
      - exec
      - shell_exec
      - system

expose_php

Sets the expose_php PHP setting.

run.config:
  engine.config:
    expose_php: 'On'

max_execution_time

Sets the max_execution_time PHP setting.

run.config:
  engine.config:
    max_execution_time: 30

max_input_time

Sets the max_input_time PHP setting.

run.config:
  engine.config:
    max_input_time: 60

memory_limit

Sets the memory_limit PHP setting. Note: This setting should not exceed the memory available on your PHP server(s).

run.config:
  engine.config:
    memory_limit: '128M'

error_reporting

Sets the error_reporting PHP setting.

run.config:
  engine.config:
    error_reporting: E_ALL

display_errors

Sets the display_errors PHP setting.

run.config:
  engine.config:
    display_errors: 'stderr'

register_globals

Sets the register_globals PHP setting

run.config:
  engine.config:
    register_globals: 'Off'

register_argc_argv

Sets the register_argc_argv PHP setting.

run.config:
  engine.config:
    register_argc_argv: 'Off'

post_max_size

Sets the post_max_size PHP setting.

run.config:
  engine.config:
    post_max_size: '8M'

upload_max_filesize

Sets the upload_max_filesize PHP setting.

run.config:
  engine.config:
    upload_max_filesize: '2M'

file_uploads

Sets the file_uploads PHP setting.

run.config:
  engine.config:
    file_uploads: true

max_file_uploads

Sets the max_file_uploads PHP setting.

run.config:
  engine.config:
    max_file_uploads: 20

max_input_vars

Sets the max_input_vars PHP setting.

run.config:
  engine.config:
    max_input_vars: 1000

default_mimetype

Sets the default_mime_type PHP setting.

run.config:
  engine.config:
    default_mimetype: 'text/html'

default_locale

Sets the intl.default_locale PHP setting.

run.config:
  engine.config:
    default_locale: 'en_US'

browscap

This allows you to specify the filepath to your browser capabilities file (browscap.ini). See PHP.net Docs for definition & configuration options. When specifying the path to your browscap.ini in your boxfile.yml, it should relative to the root of your repo.

Note: You must include your own browscap.ini in your app’s repo. They are available for free from browscap.org.

run.config:
  engine.config:
    browscap: 'app/browscap.ini'

session_save_handler

Sets the session.save_handler PHP setting.

run.config:
  engine.config:
    session_save_handler: 'files'

session_save_path

Sets the session.save_path PHP setting.

run.config:
  engine.config:
    session_save_path: '/tmp/nanobox/sessions'

session_length

Sets the session.gc_maxlifetime PHP setting.

run.config:
  engine.config:
    session_length: 3600

session_autostart

Sets the session.autostart PHP setting.

run.config:
  engine.config:
    session_autostart: 'false'

date_timezone

Sets the date.timezone PHP setting.

run.config:
  engine.config:
    date_timezone: 'US/central'

iconv_internal_encoding

Sets the iconv.internal_encoding PHP setting.

run.config:
  engine.config:
    iconv_internal_encoding: 'UTF-8'