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

Work with me

Dave is a cohesive team member, widely popular with his colleagues and always inspiring quality, exploration and innovation. One of the true ‘greats’ we’ve had the pleasure to work with

I believe in community, in inspiration and creativity. I believe it's an inspired team and a laser focus on the user's experiece that will produce the best results. I want to help frontend teams live inspired, be productive and scale better.