Hallo ich komme einfach nicht weiter
original führe ich auf einem 2 Linux Rechner folgenden Befehl aus.
per ssh als root mit sudo
sudo /opt/bitdefender/bin/mongoshell -u bd -p '!Abc1234' --eval 'db.protectedEntities.find ({'deleted': {"$lt" : ISODate()}});' --quiet devdb
nun versuche ich von einem 2 Rechner per PHP das zu realisieren
und bekomme folgenden Fehler
Connectet suche beginnt echo !Abc123 | sudo -S /opt/bitdefender/bin/mongoshell -u bd -p '!Abc1234' --eval 'db.protectedEntities.find ({'deleted' => {"$lt" => ISODate()}});' --quiet devdb &
Warning: ssh2_exec(): ssh2_exec() expects arg 4 to be of type array in /var/www/html/admin/mongotools.php on line 163
Warning: stream_set_blocking() expects parameter 1 to be resource, boolean given in /var/www/html/admin/mongotools.php on line 165
Warning: ssh2_fetch_stream() expects parameter 1 to be resource, boolean given in /var/www/html/admin/mongotools.php on line 166
Warning: stream_get_contents() expects parameter 1 to be resource, null given in /var/www/html/admin/mongotools.php on line 167
ich habe aber kein Array
würde mich freuen um Hilfe
das Hier funktioniert komischer Weise
original führe ich auf einem 2 Linux Rechner folgenden Befehl aus.
per ssh als root mit sudo
sudo /opt/bitdefender/bin/mongoshell -u bd -p '!Abc1234' --eval 'db.protectedEntities.find ({'deleted': {"$lt" : ISODate()}});' --quiet devdb
nun versuche ich von einem 2 Rechner per PHP das zu realisieren
und bekomme folgenden Fehler
Connectet suche beginnt echo !Abc123 | sudo -S /opt/bitdefender/bin/mongoshell -u bd -p '!Abc1234' --eval 'db.protectedEntities.find ({'deleted' => {"$lt" => ISODate()}});' --quiet devdb &
Warning: ssh2_exec(): ssh2_exec() expects arg 4 to be of type array in /var/www/html/admin/mongotools.php on line 163
Warning: stream_set_blocking() expects parameter 1 to be resource, boolean given in /var/www/html/admin/mongotools.php on line 165
Warning: ssh2_fetch_stream() expects parameter 1 to be resource, boolean given in /var/www/html/admin/mongotools.php on line 166
Warning: stream_get_contents() expects parameter 1 to be resource, null given in /var/www/html/admin/mongotools.php on line 167
ich habe aber kein Array
PHP-Code:
$connection_string = ssh2_connect($db_host, 22);
if (!$connection_string) die('Connection failed');
if (@ssh2_auth_password($connection_string, $user, $bdadmin))
{
echo "Connectet suche beginnt\n";
}
else
{
throw new Exception("Authentication failed!");
}
echo"echo $bdadmin | sudo -S /opt/bitdefender/bin/mongoshell -u bd -p '$db_pass' --eval 'db.protectedEntities.find ({'deleted' => {",'"$lt"'," => ISODate()}});' --quiet devdb &";
$stream = ssh2_exec($connection_string,"echo $bdadmin | sudo -S /opt/bitdefender/bin/mongoshell -u bd -p '$db_pass' --eval 'db.protectedEntities.find ({'deleted' => {",'"$lt"'," => ISODate()}});' --quiet devdb &");
echo "<div>$stream</div>";
stream_set_blocking($stream, true);
$stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
echo stream_get_contents($stream_out);
das Hier funktioniert komischer Weise
PHP-Code:
$stream = ssh2_exec($connection_string,"echo $bdadmin | sudo -S find /var/log/ -type f -regex '.*\.[0-9]+\.gz$' ;");
echo "<div>$stream</div>";
stream_set_blocking($stream, true);
$stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
echo stream_get_contents($stream_out);
Kommentar