Hello i want to restart let say apache through php i do it with a ssh client through php, so jo get Code: sudo /etc/init.d/apache2 restart Problem: it wil cut of php send of commands so it wil only stop apache but not start it. Solution: i don't know. U? My toughts: run the php script, it sends the command to the system but waits 2 seconds before executing the command so that apache kan finish up the sending to the client. Is this clear enough? Greets ColdDoT
did you try running it in quotes? Something like: "\sudo /etc/init.d/apache2 restart"\ or \"sudo /etc/init.d/apache2 restart\"
Um wablieft php script PHP: function ssh($command){ global $connection, $stream; $stream = ssh2_exec($connection, $command, FALSE); stream_set_blocking( $stream, true ); $cmd = fread($stream,4096); fclose($stream); return $cmd;}$initd = trim(str_replace("\n","",ssh("locate /etc/init.d/apache")));$reboot = ssh2_exec($connection, trim(str_replace("\n","",ssh("sudo ".$initd." restart"))), FALSE); The whole thing is that the command must run when my webpage is done loading