This PHP class represents an SSH client for connecting to SSH servers and executing commands. It provides functionality for connecting to an SSH server, authenticating using username/password, and executing commands on the server.
- PHP >= 5.3.0
- SSH2 extension
Make sure the SSH2 extension is installed and enabled in your PHP environment.
- If the SSH2 extension is not installed, a
RuntimeException
will be thrown upon instantiation of theSSH
class.
- Initializes the SSH class.
- Throws a
RuntimeException
if SSH2 extension is not installed.
- Connects to the SSH server.
- Returns
true
if connection successful,false
otherwise.
- Disconnects from the SSH server.
- Authenticates to the SSH server using username and password.
- Returns
true
if authentication successful,false
otherwise.
- Executes a command on the SSH server.
- Returns the output of the command.
This class is released under the MIT License. Feel free to modify and distribute it as needed. Contributions are welcome!