Insert data via SSH with PHP

0

I would like to know a way to send files to a VPS via SSH with PHP! Could someone suggest me a help, as I'm on a gaming server, it has an internal database.

When registering the user, send the file to vps via SSH.

    
asked by anonymous 23.07.2017 / 06:17

1 answer

0

Use the PHP Shell_exec function, see the example below:

<?php
$output = shell_exec('scp <path/arquivo> <user@servidor>:</path/to/>');
echo "<pre>$output</pre>";
?>

Where:

path/arquivo = Path e nome do arquivo que vc quer enviar
user@servidor = Login do usuário e endereço do servidor q vc quer enviar
/path/to/ = Path no servidor para o qual vc está enviando

Note:
For this script to run your machine and the user must be authorized on the server.

    
26.07.2017 / 18:53