env

env shows environment, server and request values visible to the current PHP process while masking fields that look like credentials or secrets.

DiagnosticsVersion 1.1.5Stable
lil-terminal

Overview

Use env to answer a precise question about what reached PHP: an environment value, a $_SERVER field or a request parameter. There is no raw-secret mode.

What the current PHP request can see

The environment exposed to PHP is not the same thing as an interactive shell environment. Shared hosting, the web server and PHP SAPI decide which values exist. env therefore reports the current request context and masks credential-like values instead of trying to expose everything.

Syntax

lil-terminal
env [env|server|request] [<name>]

Reference

env

show environment variables

env <name>

show variable <name>

env env [<name>]

explicitly read environment variables

env server [<name>]

show values from $_SERVER

env request [<name>]

show values from $_REQUEST

Interactive sandbox preview

Run the prepared examples directly on the page. Their results are prebuilt and shown in the browser; no terminal command is executed on the server.

Compare server and environment values

Install and manage

Install the current compatible version. Choose Base for the complete feature set or Minimum for the reduced package; use upgrade to update a module that is already installed.

Base and Minimum are two packages of the same current module release, not separate command versions.

Base package

Install the complete package with local command reference and every published mode.

install env
Minimum package

Install the reduced package. Local reference is omitted; help <cmd> -i opens the current server reference.

install env -m
Exact public version

Install exactly this published version.

install env -v 1.1.5
Check or update

Ask upgrade to check compatibility and replace the installed block only when needed.

upgrade env
Remove module

Remove the extension block while leaving the core and unrelated modules intact.

install env -u

Examples

Examples are copyable command lines, not actions executed by this website. Review paths, permissions and destructive flags before running them on a real project.

Compare server and environment values
env LIL_MODE
Training snapshot — host, time and storage values vary by server
LIL_MODE  training
Show environment variables
env
Training snapshot — host, time and storage values vary by server
API_TOKEN  [hidden]
HOME       /srv/example.test
LANG       C.UTF-8
LIL_MODE   training
Explicitly read environment variables
env env LIL_MODE
Training snapshot — host, time and storage values vary by server
LIL_MODE  training
Explicitly read environment variables
env env LIL_mode
Training snapshot — host, time and storage values vary by server
LIL_MODE  training
Explicitly read environment variables
env env API_TOKEN
Training snapshot — host, time and storage values vary by server
API_TOKEN  [hidden]
Handle a missing variable
env server
Training snapshot — host, time and storage values vary by server
DOCUMENT_ROOT       /srv/example.test/public
HOME                /srv/example.test
HTTP_AUTHORIZATION  [hidden]
SERVER_ADDR         192.0.2.10
SERVER_NAME         demo.example.test
Show values from $_SERVER
env server SERVER_NAME
Training snapshot — host, time and storage values vary by server
SERVER_NAME  demo.example.test
Show values from $_SERVER
env server DOCUMENT_ROOT
Training snapshot — host, time and storage values vary by server
DOCUMENT_ROOT  /srv/example.test/public
Show values from $_SERVER
env server HTTP_AUTHORIZATION
Training snapshot — host, time and storage values vary by server
HTTP_AUTHORIZATION  [hidden]
Show values from $_REQUEST
env request
Training snapshot — host, time and storage values vary by server
nested    {"filter":"recent","api_key":"[hidden]","items":["one","two"]}
page      overview
password  [hidden]
session   [hidden]
Show values from $_REQUEST
env request page
Training snapshot — host, time and storage values vary by server
page  overview
Show values from $_REQUEST
env request nested
Training snapshot — host, time and storage values vary by server
nested  {"filter":"recent","api_key":"[hidden]","items":["one","two"]}
Show values from $_REQUEST
env request password
Training snapshot — host, time and storage values vary by server
password  [hidden]
Explicitly read environment variables
env env NO_SUCH_VARIABLE
Training snapshot — host, time and storage values vary by server
Variable not found
Show values from $_SERVER
env server NOT_FOUND
Training snapshot — host, time and storage values vary by server
Variable not found
Show values from $_REQUEST
env request NOT_FOUND
Training snapshot — host, time and storage values vary by server
Variable not found
Show variable <name>
env -z
Training snapshot — host, time and storage values vary by server
?
Explicitly read environment variables
env env LIL_MODE extra
Training snapshot — host, time and storage values vary by server
?
Explicitly read environment variables
env env
Training snapshot — host, time and storage values vary by server
API_TOKEN  [hidden]
HOME       /srv/example.test
LANG       C.UTF-8
LIL_MODE   training

File used in this example: sandbox/config/.env.example

The example uses a file or directory from the protected /sandbox/ documentation workspace.

APP_ENV=development
APP_DEBUG=1
DB_HOST=localhost
DB_NAME=lil_sandbox
DB_USER=example
DB_PASSWORD=replace_me

Related documentation

Current public release

v1.1.52026-11-01

Production refinement

Current stable release of env. env shows environment, server and request values visible to the current PHP process while masking fields that look like credentials or secrets.