Cheers Richard and Mary, $CFG->dirroot rather than $CFG->wwwroot works.
For the benefit of others who may read this at a later date: $CFG->dirroot returns the server path which in my case is /var/www/moodle/
Whereas $CFG->wwwroot returns the web path http://www.mysite.com/
Cheers
Dave