Skip to main content
Search

Environment information in your website (HOSTING_*)

Read your website's country, limits and version from PHP or Node.js.

Last updated

Every website can find out where and how it runs: in which country its data is stored and which limits apply. You can use this to show where your data is located, or to tune your app to the memory it has. There is nothing to set up.

Where to find it

  • Environment variables that start with HOSTING_.
  • The file /etc/hosting/info.json, with the same values (read-only). The names there are in lower case, without HOSTING_, for example country.

The file is always up to date. The variables apply from the website's last restart. If something changes, such as a bigger package, read the file or restart the website.

The variables

Variable Example Meaning
HOSTING_INFO_VERSION 1 Version of this list
HOSTING_COUNTRY NL Country where the website and its data are stored (ISO 3166-1 country code)
HOSTING_EU 1 1 = inside the European Union, 0 = outside it
HOSTING_SITE_ID s_7f3k9q2m1a Fixed, unique code of this website
HOSTING_RUNTIME php php or node
HOSTING_PHP_VERSION 8.4 PHP version (PHP only)
HOSTING_NODE_VERSION 24 Node.js version (Node.js only)
HOSTING_CPU_LIMIT 1.5 Number of CPU cores for the website
HOSTING_MEMORY_LIMIT_MB 1024 Memory in MB for the whole website
HOSTING_DISK_QUOTA_MB 10240 Disk space in MB
HOSTING_PHP_WORKERS 4 Number of PHP processes at the same time (PHP only)
HOSTING_TIMEZONE Europe/Amsterdam Time zone of the website

If a value is not known, it is N/A. All values are text.

Examples

PHP:

<?php
echo getenv('HOSTING_COUNTRY');   // for example NL
$info = json_decode(file_get_contents('/etc/hosting/info.json'), true);
echo $info['memory_limit_mb'];

Node.js:

console.log(process.env.HOSTING_COUNTRY);
const info = JSON.parse(require('fs').readFileSync('/etc/hosting/info.json', 'utf8'));

Good to know

  • Names that start with HOSTING_ belong to the platform. In a Node.js app you cannot set a variable with such a name yourself.
  • When a visitor comes in over https, PHP sees it as on an ordinary server: HTTPS is on, REQUEST_SCHEME is https and SERVER_PORT is 443. An app that builds its own addresses therefore makes https:// links.
  • Variables may be added. Existing names keep their meaning.
Was this article helpful?