PHP Notice: Constant CRYPT_RANDOM_IS_WINDOWS already defined After Installing Net_SFTP From phpseclib

Recently I needed a SFTP client to upload file securely from local machine to remote SFTP server. I built a client myself using PHP function “ssh2_scp_send” to upload the file. It worked fine on my local testing environment, but failed on production because our system engineer guy only allowed the …

Getting Command Output via SSH2 Functions in PHP

Running command and getting the output via ssh2 is not as straightforward as running command directly using function exec(), it requires a few function calls using “stream”. The following code illustrates how to do it: // get connection $conn = ssh2_connect($host, $port); // login via pub-private keys ssh2_auth_pubkey_file($conn, $username, $publicKey, …