Bootstrap parameters
This topic demonstrates how to set the values of Commerce application bootstrap parameters. See Overview of application initialization and bootstrapping.
The following table discusses the bootstrap parameters that you can set:
- Not all bootstrap parameters are documented.
- You now set the application mode (developer, default, production) using the
magento deploy:mode:set {mode}
command.
Set parameters using an environment variable
This section discusses how to set the values of bootstrap parameters using environment variables.
Set the application mode
You can specify bootstrap variables as system-wide environment variables, which enables all processes to use them.
For example, you can use the MAGE_PROFILER
system environment variable to specify a mode as follows:
MAGE_PROFILER={firebug|csv|<custom value>}
Set the variable using a shell-specific command. Because shells have differing syntax, consult a reference like unix.stackexchange.com.
Bash shell example for CentOS:
export MAGE_PROFILER=firebug
PHP Fatal error
displays in the browser after you set a profiler value, restart your web server. The reason might be related to PHP bytecode caching, which caches bytecodes and PHP classpaths.Set parameters for Apache or Nginx
This section discusses how to specify the mode for either Apache or Nginx.
Nginx setting
See the Nginx sample configuration on GitHub.
Apache .htaccess setting
One way to set the application mode is by editing .htaccess
. This way, you do not have to change Apache settings.
You can modify .htaccess
in any of the following locations, depending on your entry point to the Commerce application:
<magento_root>/.htaccess
<magento_root>/pub/.htaccess
To set a variable:
-
Open any of the preceding files in a text editor and either add or uncomment the desired setting.
For example, to specify a mode, uncomment the following:
code language-conf # SetEnv MAGE_PROFILER firebug
-
Set the value of
MAGE_PROFILER
to any of the following:code language-none firebug csvfile <custom value>
-
Save your changes to
.htaccess
; you do not need to restart Apache for the change to take effect.
Apache setting
The Apache web server supports setting the application mode using mod_env
directives.
The Apache mod_env
directive is slightly different in Apache version 2.2 and Apache version 2.4.
The procedures that follows show how to set the application mode in an Apache virtual host. This is not the only way to use mod_env
directives; consult the Apache documentation for details.
To Specify a bootstrap variable for Apache on Ubuntu:
-
As a user with
root
privileges, open your virtual host configuration file in a text editor.For example, if your virtual host is named
my.magento
,- Apache 2.4:
vim /etc/apache2/sites-available/my.magento.conf
- Apache 2.2:
vim /etc/apache2/sites-available/my.magento
- Apache 2.4:
-
Anywhere in the virtual host configuration, add the following line:
code language-conf SetEnv "<variable name>" "<variable value>"
For example,
code language-conf SetEnv "MAGE_PROFILER" "firebug"
-
Save your changes and exit the text editor.
-
Enable your virtual host if you have not already done so:
code language-bash a2ensite <virtual host config file name>
For example,
code language-bash a2ensite my.magento.conf
-
After setting the mode, restart the web server:
- Ubuntu:
service apache2 restart
- CentOS:
service httpd restart
- Ubuntu:
To specify a bootstrap variable for Apache on CentOS:
-
As a user with
root
privileges, open/etc/httpd/conf/httpd.conf
in a text editor. -
Anywhere in the virtual host configuration, add the following line:
code language-conf SetEnv "<variable name>" "<variable value>"
For example,
code language-conf SetEnv "MAGE_PROFILER" "firebug"
-
Save your changes and exit the text editor.
-
After setting the mode, restart the web server:
- Ubuntu:
service apache2 restart
- CentOS:
service httpd restart
- Ubuntu: