-1

I am trying to prepare PHP script with the new server nginx web server.

Unfortunately, I havent dealt with SSH2 before for php.

Maybe some good forum would be able to help me with this?

kalmer
  • 11
  • 1
  • what exactly is an "nginx account"? – Marc B Mar 26 '15 at 15:32
  • I mean new vHost's via php. – kalmer Mar 26 '15 at 15:37
  • Your question is missing an aproximate 150 words to be understandable. ;) Please tell us exactly what you want to do. What kind of accounts do you want? HTTPAuth accounts for Nginx or SSH accounts? Do you want to edit them via PHP or just use them? Who is trying to connect to what? PHP via curl to ssh2? – ToBe Mar 26 '15 at 15:53
  • Okei, sorry. I'll need to script what makes nginx virtual host accounts. I installed VPSSIM web server to my vps and now i need php script what makes at the request to the web server during the virtual account. Form (domain) -> php script what sends data to nginx – kalmer Mar 26 '15 at 16:10

1 Answers1

1

You can do SSH in PHP with http://phpseclib.sourceforge.net/ . eg.

<?php
include('Net/SSH2.php');

$ssh = new Net_SSH2('www.domain.tld');
if (!$ssh->login('username', 'password')) {
    exit('Login Failed');
}

echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');
?>