Skip to content

Knowledgebase

Make HostBill API credentials available to both web requests and cron

domain-nexus, hostbill

The HostBill connector reads its API key from a named server environment variable. The same variable must be available to the PHP process serving HostBill pages and to the process running scheduled HostBill work. Setting a value only in your interactive shell does not configure either service automatically.

01 Configure the two execution environments

  1. Issue the intended reseller API key and save it securely. Confirm the credential's API username/email and current HTTPS endpoint.
  2. Choose the environment-variable name shown in the installed module's configuration. The generated default follows REGISTRAR_MODULE_SLUG_API_KEY.
  3. Use your host's protected process configuration to supply the key to the web PHP pool. PHP-FPM can declare an explicit env[VARIABLE_NAME] entry for the relevant pool.
  4. Supply the same value through the scheduled worker's protected environment. Do not put the secret directly in a publicly readable script or command argument.
  5. Validate and reload the affected service using the server's normal process so workers receive the new value.
  6. In HostBill's module settings, enter the variable's name in Server environment variable holding your API key, then enter the API URL and account email.

02 Verify without printing the secret

Run the module connection test and check the named reseller account. Then verify a read-only synchronisation action from the scheduled environment. Do not expose a PHP information page or dump all environment variables to prove the key exists.

PHP-FPM normally clears inherited environment values before adding those explicitly configured for the pool. Configure the specific variable that is needed rather than broadly exposing unrelated process secrets.

Common questions

Why do web actions work but cron fails?

The two processes can have different users, PHP binaries, environment values and outbound addresses. Compare those specific settings and any IP allowlist.

Why does the module reject what I entered?

The field expects a valid environment-variable name, not the API key itself. Keep the credential value in the protected process environment.

What changes during key rotation?

Update the upstream credential, replace the value in every consuming environment, reload affected workers and retest both paths. Retain the variable name unless you deliberately change the module configuration too.

Was this answer helpful?

Need a little more help?

Our support team can help you find the next step.

Contact support