Log the exception to the log file, and review the output
try {
Storage::disk('exportfile_sftp')->put(($remoteBase . $fileRelative), file_get_contents($outputFile));
} catch(\Exception $e){
Log::info($e->getMessage())
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have an remote SFTP connection:
'exportfile_sftp' => [
'driver' => 'sftp',
'host' => env('EXPORTFILE_SFTP_HOST'),
'throw' => true,
// Settings for basic authentication...
'username' => env('EXPORTFILE_SFTP_USERNAME'),
'password' => env('EXPORTFILE_SFTP_PASSWORD'),
'permissions' => [
'file' => [
'public' => 0664,
'private' => 0664,
],
'dir' => [
'public' => 0775,
'private' => 0775,
],
],
// Settings for SSH key based authentication with encryption password...
// 'privateKey' => env('IMAGE_SFTP_PRIVATE_KEY'),
// 'passphrase' => env('IMAGE_SFTP_PASSPHRASE'),
// Optional SFTP Settings...
// 'hostFingerprint' => env('SFTP_HOST_FINGERPRINT'),
// 'maxTries' => 4,
// 'passphrase' => env('SFTP_PASSPHRASE'),
// 'port' => env('SFTP_PORT', 22),
// 'root' => env('SFTP_ROOT', ''),
// 'timeout' => 30,
// 'useAgent' => true,
],
I want upload simple xml files to the remote server:
Storage::disk('exportfile_sftp')->put(($remoteBase . $fileRelative), file_get_contents($outputFile));
But I got the following error:
Expected NET_SFTP_STATUS. Got packet type: 105
How can I debug the sftp/ssh connection laravel? I tried with define('NET_SSH2_LOGGING', SSH2::LOG_COMPLEX); but not working.
Thanks!
Please or to participate in this conversation.