Ich habe mein Frontend mit einer Schaltfläche, diese Schaltfläche spricht mit dem Back-End. Das Backend ist ein Remote-Skript starten:PHP: SSH-Verbindung und Python-Skript-Ausführung
<?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$connection = ssh2_connect('192.168.56.180', 22);
ssh2_auth_password($connection, 'root', 'password');
$stream = ssh2_exec($connection, 'python /WATSON/APP/test/testlistrbk.py');
stream_set_blocking($stream, true);
$stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
echo $stream_out_contente;
fwrite($myfile, $stream_out);
fclose($myfile);
?>
Ich habe 2 Fragen, ersten, php den Python-Skript warten soll, bis zum Ende, wie gesagt, es here aber es funktioniert nicht.
zweite, Es gibt mir die folgende:
PHP Warning: fwrite() erwartet Parameter 2 in /var/www/html/WEBAPP/wa_start.php 41 auf Linie angegebene Zeichenfolge, Ressource,
Put-Ausgabe von 'var_dump ($ stream_out);' vor Fwrite hier –