import{_ as i,c as n,o as s,aj as a}from"./chunks/framework.C2AwuPrQ.js";const k=JSON.parse('{"title":"Environment Variables","description":"","frontmatter":{},"headers":[],"relativePath":"en/guide/env-vars.md","filePath":"en/guide/env-vars.md"}'),t={name:"en/guide/env-vars.md"};function l(o,e,r,h,d,p){return s(),n("div",null,[...e[0]||(e[0]=[a(`
All environment variables mentioned in the list on this page have default values unless otherwise noted. You can override the default values by setting these environment variables.
StaticPHP centralizes environment variables in the config/env.ini file. You can set environment variables by modifying this file.
We divide the environment variables supported by StaticPHP into three types:
getenv() to get them internally in StaticPHP, and you can override them before starting StaticPHP.getenv() to get them, but you cannot override them through shell scripts.config/env.ini file or through shell scripts.You can read the comments for each parameter in config/env.ini to understand its purpose.
Generally, you don't need to modify any of the following environment variables as they are already set to optimal values. However, if you have special needs, you can set these environment variables to meet your needs (for example, you need to debug PHP performance under different compilation parameters).
If you want to use custom environment variables, you can use the export command in the terminal or set the environment variables directly before the command, for example:
# export first
export SPC_CONCURRENCY=4
spc build:php "mbstring,pcntl" --build-cli
# or direct use
SPC_CONCURRENCY=4 spc build:php "mbstring,pcntl" --build-cliOr, if you need to modify an environment variable for a long time, you can modify the config/env.ini file.
config/env.ini is divided into three sections: [global] is globally effective, [windows], [macos], [linux] are only effective for the corresponding operating system.
For example, if you need to modify the ./configure command for compiling PHP, you can find the SPC_CMD_PREFIX_PHP_CONFIGURE environment variable in the config/env.ini file, and then modify its value.
If your build conditions are more complex and require multiple env.ini files to switch, we recommend that you use the config/env.custom.ini file. In this way, you can specify your environment variables by writing additional override items without modifying the default config/env.ini file.
; This is an example of \`config/env.custom.ini\` file,
; we modify the \`SPC_CONCURRENCY\` and linux default CFLAGS passing to libs and PHP
[global]
SPC_CONCURRENCY=4
[linux]
SPC_DEFAULT_CFLAGS="-O3"