note 53429 rejected from function.ssh2-exec by nlopess

From: Date: Thu, 02 Jun 2005 16:53:52 +0000
Subject: note 53429 rejected from function.ssh2-exec by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-89813@lists.php.net to get a copy of this message
Note Submitter: yairl at savion dot huji dot ac dot il ---- 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.

« previous php.notes (#89813) next »