Define the variable in the active PHP-FPM pool, using env[NAME] = value for a literal or env[NAME] = $NAME to copy a variable already present in the FPM master process. Because PHP-FPM sets clear_env = yes by default, variables exported by a shell, container, or service manager are otherwise removed before workers start. After changing the pool, test the configuration and reload or restart the FPM service, then verify the value with getenv('NAME').
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
Where PHP-FPM environment variables are configured
PHP-FPM reads its main configuration and pool files with php.ini-style syntax. Environment variables intended for application workers belong in the relevant pool section, not in an unrelated global section or only in the shell that launches a deployment command. On many installations the pool is named www and the file is called www.conf, but package layouts and filenames vary.
As an Amazon Associate I earn from qualifying purchases.
Free tools Windows power users keep installed
One-click scans. No signup required.
Find the pool that actually serves the application. A server can have several pools, each with its own user, socket, limits, and environment. A line added to an inactive pool will not change requests handled by another pool. Keep the directive inside the pool block, for example:
[www]
env[APP_ENV] = production
env[API_ENDPOINT] = https://api.example.test
The left side is always env[NAME]. The right side can be a literal value or a reference to a variable in the FPM master process. PHP code normally reads the resulting value with getenv('NAME').
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
How PHP-FPM builds the worker environment
FPM starts a master process and then creates worker processes for each pool. Before a worker is launched, FPM applies the pool’s environment policy. The important default is clear_env = yes: inherited variables are cleared, and only variables explicitly added with env[] are put back.
This behavior explains why an export such as export API_KEY=... in an interactive shell, an environment entry in a container, or a setting in a service manager may exist for the master process but still produce an empty value in PHP. The worker does not automatically receive the entire inherited environment.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesTo expose the whole inherited environment, set the directive in the pool:
[www]
clear_env = no
The shipped PHP-FPM pool template documents that this makes all environment variables available to PHP through getenv(), $_ENV, and $_SERVER. It is a broad exposure choice: every variable visible to the master can become visible to application code. Use it only when that scope is intentional and compatible with the deployment’s secret-handling policy.
Explicit entries versus disabling environment clearing
There are two practical approaches. Choose the narrow approach when the application needs a known set of settings; choose broad inheritance only when the complete process environment is deliberately part of the application’s contract.
| Approach | Scope | Portability | Security exposure | Operational simplicity |
|---|---|---|---|---|
env[NAME] = value or env[NAME] = $NAME |
One variable per entry | Works in the pool syntax across PHP-FPM package layouts; the pool path still differs by installation | Controlled: only named values are passed to workers | Requires maintaining each needed entry |
clear_env = no |
The whole inherited worker environment | Available as a pool setting, but the inherited environment depends on the service manager, container, and host | Broad: unrelated variables, including secrets, can become visible through PHP APIs | Simple to enable, but harder to audit |
Explicit entries are usually the more predictable boundary. They also make a pool file self-documenting: an operator can see which values an application is intended to receive without inspecting every variable configured by the host or container.
Step-by-step: add a variable to a pool
- Identify the active pool. Locate the pool configuration used by the FPM instance serving the site. Confirm its pool name and the file loaded by that instance; a common file is
www.conf, but the exact path is installation-specific. - Open the pool section. Edit the section beginning with a name such as
[www]. Do not place anenv[]line in a different pool and assume all workers will inherit it. - Choose a literal or inherited value. For a fixed value, add a literal assignment:
env[APP_ENV] = production
env[FEATURE_FLAG] = checkout-v2
When the value is supplied by the FPM master environment, reference it with a dollar sign:
Rank #2
- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
env[API_KEY] = $API_KEY
env[REGION] = $REGION
With the second form, the master must already have API_KEY or REGION. The pool line does not create a missing source value; it asks FPM to copy the value it inherited.
- Keep the exposure deliberate. Add only the names the application needs. Do not switch to
clear_env = nomerely because one variable is missing unless broad inheritance has been reviewed. - Save a recoverable change. Preserve the previous pool file or use your normal configuration-management process. A syntax error can prevent a reload, and an incorrect value can affect every request handled by that pool.
- Test the FPM configuration. Use the configuration-test command supplied by your PHP-FPM package (often the installed FPM binary’s
-toption). Run it with the same configuration and privileges used by the service where possible. A successful test checks syntax; it does not prove that the source variable exists or that the application can read it. - Reload or restart FPM. Ask the operating system’s service manager to reload the FPM service after a valid edit. If that platform cannot reload configuration safely, restart the service instead. Existing workers may continue using their old environment until they are replaced, so do not treat saving the file as activation.
- Verify from PHP. Use a controlled diagnostic endpoint or a CLI test in the same runtime context and check
getenv('NAME'). Confirm the expected non-secret value, and remove or protect the diagnostic endpoint when finished.
Literal values and inherited values
Use a literal for a pool-specific constant
A literal is appropriate when the value is not meant to change with the host environment or when a pool should have a value independent of the service manager:
[www]
env[APP_ENV] = production
env[LOG_CHANNEL] = stderr
The value is stored in the pool configuration, so treat the file as sensitive if the value is a credential, token, or other secret. File permissions, backups, configuration-management logs, and code review systems may all expose it.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Use $NAME to copy a service or container variable
Referencing $NAME keeps the value outside the pool file. The arrangement works only if the FPM master receives the variable before it parses the pool configuration:
[www]
env[DATABASE_URL] = $DATABASE_URL
If DATABASE_URL is absent from the master’s environment, PHP will not receive a useful value through this entry. Check the process supervisor, service unit, container definition, or startup script that launches FPM rather than changing the PHP code first.
Configuration-variable expansion and defaults
FPM configuration values can use environment-variable expansion. The syntax is useful for paths and identity settings as well as env[] values. For example:
listen = /var/run/php-fpm-${POOL_NAME}.sock
user = ${USER_NAME:-www-data}
group = ${USER_NAME:-www-data}
The ${VAR:-default} form supplies the fallback when the variable is unset or null. The PHP manual documents this default form as supported from PHP 8.3.0. On older PHP versions, do not assume the fallback syntax is available; check the version-specific FPM documentation or use a value supplied by the service configuration instead.
Rank #3
- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
Expansion happens while FPM reads its configuration. It does not make a later shell export visible to already-running workers. After changing the source environment, reload or restart FPM so the master and its new workers read the current values.
Passing variables from systemd
When systemd launches PHP-FPM, the service unit or an environment file is the source for variables referenced as $NAME. Configure the variable in the unit’s environment settings, then make systemd reread the unit and restart or reload the FPM service according to your distribution’s service behavior. The essential sequence is:
- Define the variable in the unit’s
Environment=setting or anEnvironmentFile=used by the FPM service. - Reload systemd’s unit definitions after editing the unit or environment-file reference.
- Confirm that the FPM master starts with the variable present.
- Keep
env[NAME] = $NAMEin the active pool if the worker should receive only that variable. - Reload or restart FPM after both configuration layers are ready.
A common failure is changing a shell profile instead of the system service. Interactive shell exports affect commands launched from that shell; they do not automatically alter a daemon started by systemd. Another is updating the unit but not restarting FPM, leaving the old master process and its workers in place.
Passing variables from Docker or another container runtime
Container environment settings reach PHP only if the FPM process is launched with them. Define the variable in the container’s runtime configuration, then expose it deliberately in the pool:
[www]
env[APP_ENV] = $APP_ENV
env[BUILD_ID] = $BUILD_ID
For a literal that belongs to this image or pool, put the value directly in the pool file instead. For a deployment-specific value, inject it when the container starts and use the dollar-sign form above. Recreating or restarting the container is normally required when its environment definition changes; reloading only a mounted pool file cannot add a variable that the FPM master never received.
Container images often contain more environment variables than a single application needs. Keeping clear_env = yes and naming the required entries gives the PHP worker a smaller exposure surface. If you intentionally choose clear_env = no, review variables supplied by the orchestrator, sidecars, and base image because all of them may become readable through PHP.
Reading the value in PHP
The portable primary API is getenv():
<?php
$value = getenv('APP_ENV');
if ($value === false) {
// Handle a missing variable without assuming an empty string is valid.
}
With clear_env = no, the PHP-FPM pool template also documents availability through $_ENV['APP_ENV'] and $_SERVER['APP_ENV']. Applications can differ in how they populate superglobals, so use getenv() for the direct environment lookup and verify behavior in the actual FPM request context.
Rank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
Do not print credentials, connection strings, or complete process environments in a production response or log. For a diagnostic check, report only whether a non-secret variable is present and perhaps its expected value, then remove or restrict the endpoint.
Why getenv() is empty in PHP-FPM
The variable exists only in your shell
An export in a terminal affects processes launched from that terminal. A web request normally reaches an FPM master started by a service manager, so the terminal’s environment is unrelated. Put the value in the service or container environment, or use a literal pool entry.
clear_env removed the inherited value
This is the default behavior. If the master has the variable but the worker does not, add an explicit env[NAME] = $NAME entry. Set clear_env = no only when exposing the complete inherited environment is acceptable.
The entry is in the wrong pool or file
Multiple FPM instances and pools can run on one host. Confirm the request’s socket or upstream points to the pool you edited, and confirm that the running master loads that file. A valid line in an unused file has no effect.
The master never received the source variable
The dollar-sign form copies the master’s value; it cannot retrieve a value that was never injected. Inspect the service manager or container definition and verify the variable before restarting FPM. If the source is intentionally absent, use a literal or the documented default-expansion form where the PHP version supports it.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Workers were not replaced
FPM workers keep the environment assigned at process creation. Reload or restart through the service manager after editing the pool or changing the service environment. If a graceful reload leaves old workers serving briefly, wait for the transition or perform the platform’s controlled restart.
The PHP test is running in a different context
CLI PHP and PHP-FPM can use different binaries, configuration files, users, and environments. A value visible from a terminal does not prove that the web pool receives it. Verify through the same FPM-backed request path that the application uses.
Best Value
Security and maintenance decisions
Prefer a narrow allow-list
Each explicit env[] line documents an intentional dependency and limits accidental disclosure. This is especially useful when a host or container carries deployment credentials, cloud metadata, debugging flags, or unrelated application settings.
Treat pool files as secret-bearing configuration
A literal secret in www.conf can appear in backups, deployment archives, file searches, or configuration reviews. If the value comes from a secret-management process, inject it into the FPM service environment and copy only the required name with env[NAME] = $NAME. The pool file still reveals the variable name, but not necessarily its value.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Review broad inheritance before enabling it
clear_env = no is convenient for legacy applications and troubleshooting, but it changes the exposure boundary for every worker in that pool. Record why it is needed, identify which process can read the variables, and revisit the choice when the deployment or secret policy changes.
Keep configuration and runtime changes synchronized
Document the source of each variable: pool literal, systemd unit, environment file, container definition, or another supervisor. Apply the source change, pool change, syntax test, and FPM reload as one operational task. This prevents a correctly written pool entry from pointing at a value that the running master still lacks.
A practical verification checklist
- Is the edited file loaded by the FPM instance serving this application?
- Is the
env[NAME]line inside the intended pool section? - For
$NAME, does the FPM master receiveNAMEfrom systemd, the container runtime, or another supervisor? - Is
clear_env = yesintentionally limiting inherited variables, or has a reviewed decision been made to useclear_env = no? - Does the installed PHP version support any expansion syntax used, particularly
${VAR:-default}, documented from PHP 8.3.0? - Did the package’s FPM configuration test pass?
- Was FPM reloaded or restarted after the edit?
- Does a controlled FPM request return the expected result from
getenv('NAME')? - Have diagnostic output and secret values been kept out of production responses and logs?
Putting the pieces together
A tightly scoped pool might look like this:
[www]
clear_env = yes
env[APP_ENV] = production
env[DATABASE_URL] = $DATABASE_URL
env[TMPDIR] = /tmp
Here, the application receives three named values. Two are literal pool settings, while DATABASE_URL must exist in the FPM master’s environment. The worker does not receive unrelated variables because clearing remains enabled.
A pool that deliberately trusts the complete service environment would instead contain:
Recommended Free Tools
[www]
clear_env = no
That shorter configuration has a larger behavioral and security consequence. Every variable inherited by the master becomes eligible for PHP access, so the service or container environment must be treated as part of the application’s exposed configuration.
In either design, configuration is not active until FPM has successfully read it and new or reloaded workers are running. Testing the loaded configuration and verifying one controlled request closes the gap between an edited file and the environment PHP actually sees.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




