1. There are three servers and the operating systems are 10.1 10.2 11.2 and 11.2. We found that does not need to be installed and has some extensions. If you have not installed yast, It is very convenient to install yast.
Test on the 10.1 server, because you need to install libssh before installing the ssh2-0.11.0.tgz, so go to the official website to download. N versions have been downloaded. None. Errors occur during make.
I don't want to find the reason, because this situation may be caused by many reasons.
Another server, 10.2, when the trial to libssh2-0.18 time, actually succeeded.
Okay, next, it should compile the ssh2-0.11.0.tgz, huh, it is relatively smooth. Actually succeeded.
Now, record your operation process so that you do not forget it. You can read this document again. Haha.
Two software packages are required:
Ssh2-0.11.0.tgz: http://pecl.php.net/package/ssh2
Libssh2-0.18.tar.gz: http://sourceforge.net/projects/libssh2/files/
First install libssh2-0.18.tar.gz
Simple Steps:
Tar zxvf libssh2-0.18.tar.gz
Cd libssh2-0.18
./Configure
Make & make install
Wait for a while.
It should have been successful.
Next, install ssh2-0.11.0.tgz
Tar zxvf ssh2-0.11.0.tgz
Cd ssh2-0.11.0
Phpize
./Configure -- with-ssh2
Make
After that, the required ssh2.so file will be generated in the modules directory in the current directory.
The following configuration makes apache understand it.
Copy the file to your. so file. Note that the storage location of the so file varies depending on the version.
My default path is:
/Usr/lib/php5/extensions/
Cp ssh2.so/usr/lib/php5/extensions/
Add a configuration file,
Copy an ssh2.ini file in the/etc/php5/conf. d/directory.
Cp mysql. ini ssh2.ini
Edit ssh2.ini and modify the content:
Extension = ssh2.so
Now, restart apapche.
Apache2ctl-k restart
Run the php-I | grep ssh2 command.
No surprise, you will see the relevant information
/Etc/php5/conf. d/ssh2.ini,
Registered PHP Streams => php, file, data, http, ftp, https, ftps, ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp, zip, compress. zlib
Ssh2
Libssh2 version => 0.18
Banner => SSH-2.0-libssh2_0.18
PWD =>/srv/www/vwokan/wokan2.0/ssh2-0.11.0
_ SERVER ["PWD"] =>/srv/www/vwokan/wokan2.0/ssh2-0.11.0
This information indicates that the operation is successful.
Next, we will use php to execute the ssh2 extension command.
<? Php
$ Connection = ssh2_connect ("172.16.18.252", 22 );
If (sssh2_auth_password ($ connection, "root", "123456 ")){
Echo "Authentication Successful! ";
} Else {
Die (Authentication Failed ...);
}
?>
You will see "Authentication Successful.
Well, I encountered it. In an accident, I checked it. The following prompt appears every time:
Authentication Failed...
There are no errors in user names and passwords.
Finally, check the local ssh configuration.
Vi/etc/ssh/sshd_config
Found in:
PasswordAuthentication no
Modified:
PasswordAuthentication yes
Save and restart ssh
/Etc/init. d/sshd restart
Haha, it actually passed.