phpseclib login to SFTP working on windows but not on linux

when tried logging in to the SFTP server using key and password on windows machine, I am successfully able to login and transfer files from local to remote. The same code fails when i've pushed my code to gitLab which points to a linux machine..

I tried printing $sftp->getLog() which returns the logs on windows but on linux it just prints pre tags and nothing inside these tags.

I'm using phpseclib 1.0.19 and php version 7.3

for logging in i'm using the code:

$sftp=new Net_SFTP('hostIPAddress');
$key= new Crypt_RSA();
$key->loadKey(file_get_contents('Path to private key'));
print_r($sftp->getLog()); //prints logs on windows and nothing inside pre tags on linux
print_r($sftp->getSFTPLog()); // prints something on windows but nothing on linux

Logs come fine on the windows machine but empty when on linux..

Help the code is working fine on my local windows machine..

Also while loading the key on windows local, one of the keys inside the $key array named 'modulus' gets initialised to a BigIntegerMath object with an int value in 'value' key but when I try printing the contents of the $key array on linux server this prints the other array contents correctly but for that 'value' key it just shows:

value=Array (no int value as in windows machine case).

Help needed why is this happening!