Contents
- Overview of setting bootstrap parameter values
- Specifying a parameter value using an environment variable
- Specifying a parameter value using your web server environment
Overview of setting bootstrap parameter values
This topic discusses how to set the values of Magento application bootstrap parameters. More information about Magento application bootstrapping.
The following table discusses the bootstrap parameters you can set:
Bootstrap parameter | Description |
---|---|
MAGE_DIRS | Specifies custom directory and URL paths |
MAGE_PROFILER | Enables an HTML profiler |
- Not all bootstrap parameters are documented at this time.
- You now set the Magento mode (developer, default, production) using the magento application command.
Specifying a parameter value using an environment variable
This section discusses how to set the values of bootstrap parameters using environment variables.
Set the mode using an environment variable
You can specify Magento 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
Specifying a parameter value
This section discusses how to specify the mode for either Apache or nginx.
See one of the following sections for more information:
- Specify a variable using an nginx setting
- Specify a variable using .htaccess (Apache only)
- Specify a variable using an Apache setting
Specify a variable using an nginx setting
See the nginx sample configuration on GitHub.
Specify a variable using .htaccess (Apache only)
One way to set the Magento mode is by editing .htaccess
. This way, you don鈥檛 have to change Apache settings.
You can modify .htaccess
in any of the following locations, depending on your entry point to the Magento application:
<your Magento install dir>/.htaccess
<your Magento install dir>/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:
# SetEnv MAGE_PROFILER firebug
-
Set the value of
MAGE_PROFILER
to any of the following:firebug csv <custom value>
-
Save your changes to
.htaccess
; you don鈥檛 need to restart Apache for the change to take effect.
Specify a variable using an Apache setting
The Apache web server supports setting the Magento mode using mod_env
directives.
The Apache mod_env
directive is slightly different in version 2.2 and version 2.4.
The procedures that follows show how to set the Magento mode in an Apache virtual host. This is not the only way to use mod_env
directives; consult the Apache documentation for details.
Specify a bootstrap variable for Apache on Ubuntu
This section assumes you鈥檝e already set up your virtual host. If you have not, consult a resource such as this digitalocean tutorial.
To set a Magento bootstrap variable using your web server鈥檚 environment:
-
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:
SetEnv "<variable name>" "<variable value>"
For example,
SetEnv "MAGE_PROFILER" "firebug"
- Save your changes and exit the text editor.
-
Enable your virtual host if you haven鈥檛 already done so:
a2ensite <virtual host config file name>
For example,
a2ensite my.magento.conf
-
Restart the web server:
service apache2 restart
Specify a bootstrap variable for Apache on CentOS
This section assumes you鈥檝e already set up your virtual host. If you have not, consult a resource such as this digitalocean tutorial.
To set a Magento bootstrap variable using your web server鈥檚 environment:
-
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:
SetEnv "<variable name>" "<variable value>"
For example,
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
Find us on