note 53429 added to function.ssh2-exec

From: Date: Wed, 01 Jun 2005 12:03:01 +0000
Subject: note 53429 added to function.ssh2-exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-89734@lists.php.net to get a copy of this message
I'm trying to detect if public_html exist or not but it doesn't work: $stream=ssh2_exec($conn_id,'cd ./public_html'); stream_set_blocking( $stream, true ); $cmd=fread( $stream, 4096 ); $sftp = ssh2_sftp($conn_id); if(!$cmd){ ssh2_sftp_mkdir('public_html'); }else{ $upload = ssh2_scp_send($conn_id,"$source_file",$target,0644); } But cd command doesn't return false or any thing, it's always empty . If cd successed scp_send doesn't copy the files in public_html. Something is wrong because the most command line doesn't work with ssh2_exec, while only ls . successed to return a normal answer. i tryed to detect the directory with ssh2_sftp_stat($sftp,"public_html") checking for exemple $info['uid'] but the function failed, it wait untill the server stop it. Anybody know how it must work? i couldn't find exemples, i'm working with php 4.3.10, libssh 2.05. ---- Manual Page -- http://www.php.net/manual/en/function.ssh2-exec.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53429 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53429&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53429&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53429&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53429&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53429&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53429&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#89734) next »