Setting environment variables in Apache

Apache allows you to define environment variables that are used when Apache runs. The environment variable definition file is as follows.

#Environment variable definition file
/ etc / apache2 / envvars

If you define the loading of environment variables here, it will be loaded when Apache is restarted.

Example of using environment variables in Apache

Here is an example of using environment variables in Apache.

I want to specify Perl to execute CGI

If you have a CGI script, you may want to use your own installed user Perl instead of the system Perl.

Add the user Perl's path to the beginning of your current PATH. The which command makes it easy to see where the user Perl is, so set the path without the trailing "/ perl".

export PATH = "/ home / admins / perl5 / perlbrew / perls / perl-5.30.2 / bin: $PATH"

I want to load additional Perl libraries

Suppose you have a Perl application library in your location. In such cases, you can use the PERL5LIB environment variable to load the library.

export PERL5LIB = / my / lib

Associated Information