NAME=value creates a shell variable, visible only to the current shell. export NAME makes it an environment variable that child processes inherit, which is how APP_ENV reaches PHP's getenv(). NAME=value command sets it for one command. PATH lists the directories searched, left to right, for a command; prepend your own with export PATH="$HOME/bin:$PATH". Ubuntu 225 's ~/.profile does this for ~/bin and ~/.local/bin if they exist.
GREETING=hello
bash -c 'echo "child sees: [$GREETING]"' # a shell variable stays in this shell
export GREETING
bash -c 'echo "child sees: [$GREETING]"' # an environment variable is inherited
APP_ENV=staging php -r 'echo getenv("APP_ENV"), PHP_EOL;' # for one command only
echo "$PATH" | tr ':' '\n' | head -n 6 # searched left to rightchild sees: [] child sees: [hello] staging /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin
A login shell (an SSH session) reads /etc/profile, then the first of ~/.bash_profile, ~/.bash_login and ~/.profile. An interactive non-login shell reads ~/.bashrc, which Ubuntu's ~/.profile also sources, so aliases and PS1 belong there. Scripts, cron jobs and systemd 142,543 services read none of these files.