!$path means if anything in !$path, it will be false. So it will be !is_dir(false).
I think your code will be if (!is_dir($path)) { ... NOT if (!is_dir(!$path)) {
Little Update:
As @NiettheDarkAbsol said, is_dir takes the string (the directory name) as parameter, so the false [which get from !$path ($path should be '/usr/htdocs/site/' in this case, so !$path should be bool false)] will be convert in to string '' (empty).
And the '' is a invalid directory name in most common used file systems. So, the is_dir will can't found the any directory by that invalid name. And because of that, it will return false, which triggered the exception throwing to report you the path is invalid.
Thanks to @NiettheDarkAbsol tell me the rest thing.