In case the command:
$sftpStream = @fopen('ssh2.sftp://'.$sftp.$dstFile, 'w');
causes you a segmentation fault, try using:
$sftpStream = @fopen('ssh2.sftp://'.intval($sftp).$dstFile, 'w');
Credit: http://stackoverflow.com/questions/7414175/php-sftp-seg-fault