PHP Function SSH2_AUTH_PASSWORD
The php function ssh2_auth_password allows you to authenticate over SSH with a plain text password. This can be useful when you need to perform SSH or SFTP tasks and have no access to a Unix shadow file, homebrewed authentication script with root privileges, or need to connect to a host that requires a challenge response authentication.
You should note that ssh2_auth_password raises a PHP warning on failure, so you may want to set display_errors and error_reporting to On when using this function. Additionally, the ssh2 library doesn't support partial auths very cleanly (e.g. if you pass public key and password, it will fail).
To get this function to work properly you'll need a full ssh2 installation on your host machine. Installing this will allow you to leverage a number of handy classes which simplify the code needed to perform SSH and SFTP operations. ssh2_scp_send() and ssh2_sftp_send() will both return a boolean which indicates whether the operation was successful or not. This will allow you to make sure that the SSH and SFTP connections were made before attempting to copy or move files from your local computer to the remote server.