This document describes the behaviour and environment configuration when running your PHP apps on AusNimbus.
Table of Contents
- Runtime Environments
- Web Process
- Dependency Management
- Environment Configuration
- Debug Mode
AusNimbus supports each of the major releases.
The currently supported versions are
AusNimbus supports Apache 2.4 as the dedicated web server for your PHP applications. Apache interfaces with PHP-FPM using
AusNimbus handles SSL termination at the load balancer.
By default the root of your repository will be used as the document root. To use a sub-directory you may use the following environment variable:
|DOCUMENTROOT||Path that defines the DocumentRoot for your application (ie. /public)|
The builder uses composer for installing dependencies. A valid
composer.json file must be included for dependencies to be installed.
The following command is run to install your dependencies:
./composer.phar install --no-interaction --no-dev --optimize-autoloader
It is recommended to include a
composer.lock file in your repository to ensure the state of your dependencies are consistent.
By default your application will be built and deployed in
production. AusNimbus will not install development dependencies from the
require-dev section of
composer.json unless you explicitly set the [Debug Mode](#Debug Mode) as outlined below.
The Prestissimo parallel composer install plugin boasts significantly faster dependency install times and can be installed with the following environment variable:
|PRESTISSIMO||Set to TRUE will enable the Prestissimo parallel composer install plugin|
Both the PHP and OPCache sizes are automatically configured for you based on your app instance size.
|Small||php=128MB / opcache=64MB|
|Medium||php=128MB / opcache=128MB|
|Large||php=256MB / opcache=128MB|
|2xLarge||php=368MB / opcache=128MB|
Some of these values may not be ideal based on your application requirement. So you may optionally overwrite these values with the following environment variables:
|PHP_MEMORY_LIMIT||Set the PHP memory limit in MB|
|OPCACHE_MEMORY_CONSUMPTION||Set the OPCache shared memory storage in MB|
If you would like to use a custom composer mirror you may use the following environment variable:
|COMPOSER_MIRROR||Define a custom composer registry mirror for downloading dependencies|
AusNimbus automatically calculates the number of child processes running your app based on the memory limits defined above.
The default configuration does not reserve any memory for the Apache web server and is optimized for applications that have auto scaling enabled.
This may be undesirable for non-scalable or memory intensive apps. If your application restarts frequently you may want to overwrite this configuration:
|WEB_CONCURRENCY||Set the number of child processes running your app, by default this is automatically configured for you.|
.ini files placed into your repository will be loaded after the main
You may also configure OPCache with the following environment variables:
|OPCACHE_VALIDATE_TIMESTAMPS||Whether OPCache should check for changes in files. When set to 0, you must reset the OPcache manually or restart the webserver for changes to the filesystem to take effect. Default: 0|
|OPCACHE_REVALIDATE_FREQ||How often OPCache should check for changes in files. Ignored if
AusNimbus builders are split into two stages:
Both stages are completely extensible, allowing you to customize or completely overwrite each stage.
Build Stage (assemble)
If you want to customize the build stage, you need to add the executable
.s2i/bin/assemble file in your repository.
This file should contain the logic required to build and install any dependencies your application requires.
If you only want to extend the build stage, you may use this example:
#!/bin/bash echo "Logic to include before" # Run the default builder logic . /usr/libexec/s2i/assemble echo "Logic to include after"
Runtime Stage (run)
You may customize or overwrite the entire runtime stage by including the executable file
This file should contain the logic required to execute your application.
If you only want to extend the run stage, you may use this example:
#!/bin/bash echo "Logic to include before" # Run the default builder logic . /usr/libexec/s2i/run
As the run script executes every time your application is deployed, scaled or restarted it's recommended to keep avoid including complex logic which may delay the start-up process of your application.
Persistent Environment Variables
The recommend approach is to set your environment variables in the AusNimbus dashboard.
However it is possible to store environment variables in code using the
The file expects a key=value format eg.
The AusNimbus builder provides a convenient environment variable to help you debug your application.
|DEBUG||Set to TRUE will enable common debug settings (ie.
Why aren't my changes being picked up
The default value for
OPCACHE_VALIDATE_TIMESTAMPS=0 means any changes you make to files will not be read by the PHP process.
This is setting improves the response time of apps production as PHP files may be loaded entirely from memory.
If you require to edit files you should set the environment variable