Environment Variables
For each website, the following environment variables are set by default:
for all websites
WEBSITE_SERVER_NAME
: configured hostnamesWEBSITE_TYPE
: website typeWEBSITE_WEBROOT
: webroot location
if PHP is enabled
FCGI_SOCKET_PATH
: path to the fcgi socketPHP_VERSION
: selected PHP version
if a database is configured
DB_HOST
: database hostnameDB_NAME
: database nameDB_USERNAME
: database usernameDB_PASSWORD
: database password
There might be additional environment variables that get set, depending on the website type or advanced configurations (for example see Node.js and Docker).
Custom Environment Variables
You can set or override environment variables per website, use the envvar
option in custom JSON:
{
"envvar": {
"MYENVVAR": "this is the value",
"DB_HOST": "override global DB_HOST variable here",
"http_proxy": "override global http_proxy variable here"
}
}
Warning
Variable names can only contain lower and uppercase letters [A-Za-z]
, numbers [0-9]
and underscores _
, also they cannot begin with a number.
Example Usage in PHP
$config = array(
'db_host' => $_SERVER['DB_HOST'],
'db_name' => $_SERVER['DB_NAME'],
'db_username' => $_SERVER['DB_USERNAME'],
'db_password' => $_SERVER['DB_PASSWORD'],
)