Sometimes you may need to set Apache PATH environment variable. Typically, the most common way to do this is useing SetEnv command in Linux. Here is our detailed tutorial to set environment variables using SetEnv. However, if that does no work for you, then here is another way to do this.
How to Set Apache PATH Environment Variable
Apache’s Environment variables are stored in /etc/apache2/envvars in Ubuntu, /etc/sysconfig/httpd in Redhat and at /etc/rc.conf in BSD.
Open terminal and run the following command to open this file.
$ sudo vi /etc/apache2/envvars
Look for the line
PATH = ...
Also read : How to Export to CSV in NodeJS
For example, it might be something like
Let us say you want to append /opt/local/bin to the PATH variable.
Also read : How to Make POST request in cURL
You can add :/opt/local/bin to the above PATH variable
OR add the following line to /etc/apache2/envvars file.
Save and close the file.
Restart Apache server to apply changes.
$ sudo service apache2 restart
That’s it. Your Apache server’s environment variable will be updated.