Set Custom Environment Variables in Apache for PHP sites

Aaarg! I found this before and didn’t make a note. That’ll teach me. If you want to set custom environment variables for a particular php site running on apache then you can add them in using SetEnv where you specify the VirtualHost details. I use the http-vhosts.conf file on my macbook.

Here’s an example:

<VirtualHost *:80>
    DocumentRoot "/path/httpd"
    ServerName mysite.local
    ServerAlias mysite.local
    SetEnv VARNAME myvariable

now I shouldn’t forget it again