PHP
This is a generic PHP engine used to launch PHP web and worker services on Nanobox. It exposes a wide collection configuration options generally handled in the php.ini and other configuration files. Both PHP settings and web server settings are available.
Usage
To use this engine, specify in the boxfile.yml:
run.config:
engine: php
Composer
This engine uses Composer to manage dependencies. If a composer.json file exists at the root of your application, dependencies will be fetched during a build. The composer install command can be customized during the build process using a setting in the boxfile.yml.
run.config:
engine: php
engine.config:
composer_install: "composer install --no-interaction --prefer-source"
Basic Configuration
This engine exposes configuration options through the boxfile.yml, a yaml config file used to provision and configure your app's platform.
Advanced Configuration Options
This Readme outlines only the most basic and commonly used settings. For the full list of available configuration options, view the Advanced PHP Configuration options.
Overview of Basic boxfile.yml Configuration Options
run.config:
engine.config:
# PHP Settings
runtime: 'php-7.0'
extensions:
- curl
- gd
- mbstring
- pdo_mysql
zend_extensions:
- ioncube_loader
- opcache
max_execution_time: 30
max_input_time: 30
error_reporting: E_ALL
display_errors: 'stderr'
post_max_size: '8M'
upload_max_filesize: '2M'
file_uploads: true
# Web Server Settings
webserver: 'apache'
# Apache Settings
apache_document_root: '/'
apache_php_interpreter: fpm
apache_access_log: false
Quick Links
Web Server Settings
PHP Settings
Apache Settings
Web Server Settings
The following setting is used to select which web server to use in your application.
webserver
The following web servers are available:
- apache (default)
- nginx
- builtin (PHP's built-in web server available in 5.4+)
run.config:
engine.config:
webserver: 'apache'
Web server specific settings are available in the following sections of the Advanced PHP Configuration doc:
Apache Settings
Nginx Settings
Built-In PHP Web Server Settings
PHP Settings
The following settings are typically configured in the php.ini. When using Nanobox, these are configured in the boxfile.yml.
- runtime
- extensions
- zend_extensions
- max_execution_time
- max_input_time
- error_reporting
- display_errors
- post_max_size
- upload_max_filesize
- file_uploads
- date_timezone
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'
extensions
Specifies what PHP extensions should be included in your app's environment. To see what PHP extensions are available, view the full list of available PHP extensions.
run.config:
engine.config:
extensions:
- curl
- gd
- mbstring
- pdo_mysql
zend_extensions
Specifies what Zend extensions should be included in your app's environment. To see what Zend extensions are available, view the Zend Extensions section of the PHP extensions list.
run.config:
engine.config:
zend_extensions:
- ioncube_loader
- opcache
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
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'
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
date_timezone
Sets the date.timezone
PHP setting.
run.config:
engine.config:
date_timezone: 'US/central'
Apache Settings
The following settings are used to configure Apache. These only apply when using apache
as your webserver
.
apache_php_interpreter
Specify which PHP interpreter you would like Apache to use.
- fpm (default)
- mod_php
run.config:
engine.config:
apache_php_interpreter: fpm
apache_access_log
Enables or disables the Apache Access log.
run.config:
engine.config:
apache_access_log: false
Help & Support
This is a generic (non-framework-specific) PHP engine provided by Nanobox. If you need help with this engine, you can reach out to us in the #nanobox IRC channel. If you are running into an issue with the engine, feel free to create a new issue on this project.