Insert data via SSH with PHP

Asked

Viewed 218 times

0

I would like to know a way to send files to a VPS via SSH with PHP ! Could someone suggest me a help, because I am on a game server, the same has an internal database.

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

1 answer

0

Use PHP’s 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

Obs.:
For this script to work your machine and the user has to be authorized on the server.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.