Turns out the phpseclib code was unable to find the following files:
Math/BigInteger.php Crypt/Random.php Crypt/Hash.php Crypt/Base.php
...because the script relies on the php include path which by default is c:\php\pear.
So I solved it by adding the following two lines to the top of my script.
$currentdirectory = getcwd(); set_include_path(get_include_path().";".$currentdirectory.'/common/PHP SFTP');