SSH package for PHP?

1.2k Views Asked by At

Ok this may seem like a very, very awkward question but here's my problem:

I need to be able to SSH to my site while at the library at my school but the only thing is that it NEVER works if I try to FileZilla it or puTTy it. I am not even using port 22 rather a separate port. Still it seams as if it is blocked.

I was wondering if I could use some package that I can add to my admin section on my site so I can ssh to my site directly from the browser (Also my school uses windows so doing ctrl+x in nano doesn't work.

I would preferably use PHP, as I can not use any other Server Side language (technical reasons) and I am pretty noob to websites and stuff, this is my first project as such.

4

There are 4 best solutions below

2
On BEST ANSWER

PHP has an excellent built-in SSH package (via pecl): https://www.php.net/manual/en/book.ssh2.php

If you don't already have it, here are installation instructions: https://www.php.net/manual/en/install.pecl.intro.php

1
On

Check out phpSecLib. It implements the SSH protocol in PHP and is pretty common for this type of thing.

There are others available too if you search for something like "PHP SSH client"

5
On

It seems like you want to run commands on your own server. Installing an SSH library for PHP will not help you in that regard, unless you ssh from your server to itself. How about using a php web shell?

You'll have to make sure to secure it but it should allow you to run any commands you need within the browser.

0
On

The connection from your school to the Internet is probably protected by a firewall.

In the easiest case the workstations in your school have direct access to the Internet but the firewall blocks connections to most ports. If this is the case you can try running sshd on port 80, the port used for HTTP.

In a more complicated case the workstations must pass through a HTTP proxy in order to access web pages. Apparently Putty allows connecting to an SSH server through a HTTP proxy, you just have to configure it correctly.

None of this requires PHP modules as the connections are made directly to sshd.