I bet the env var is probably only defined for your user and needs to be defined for all users, or at least for the user as which the web server runs. Try to right-click on My Computer, select 'Advanced', select 'Environment Variables' and enter MYVAR with the appropriate value in the
Variables area. If that doesn't work, check if you can create env vars from within your web server's configuration tool.