php中ssh2扩展安装详解
1、有三台服务器,操作系统分别为:10.1 10.2 11.2三个不同版本,发现11.2不需要安装,已经拥有些扩展了。如果你没有安装,可能很方便的通过yast安装完成。
在10.1服务器上测试,因为安装ssh2-0.11.0.tgz之前,需要安装libssh,所以就到官网下载。下载了N多个版本。都不行。都是在make时出错。
都不想去查找原因了,因为这种情况,可能是多方面的。
又换服务器,10.2,当偿试到libssh2-0.18的时间,居然成功了。
好了,接下来,就应该编译ssh2-0.11.0.tgz了,呵呵,还比较顺利。居然成功了。
现在,把自己的操作流程记录下来,以免以后自己忘记了,还可以再看这个文档。呵呵。
需要两个软件包:
ssh2-0.11.0.tgz 下载地址:http://pecl.php.net/package/ssh2
libssh2-0.18.tar.gz 下载地址:http://sourceforge.net/projects/libssh2/files/
先安装,libssh2-0.18.tar.gz
步骤简单:
tar zxvf libssh2-0.18.tar.gz
cd libssh2-0.18
./configure
make && make install
等待一会儿吧。
不出意外,应该就成功了。
接下来,安装ssh2-0.11.0.tgz
tar zxvf ssh2-0.11.0.tgz
cd ssh2-0.11.0
phpize
./configure --with-ssh2
make
完成之后,会在当前目录中的modules目录中生成你所需要的ssh2.so文件
下面配置,让apache认识它了。
这个复制到你的.so文件的地方就行了,不过这个地方要注意,不同版本,so文件存放的位置有点差别。
我的是默认路径:
/usr/lib/php5/extensions/
cp ssh2.so /usr/lib/php5/extensions/
还有个,就是添加配置文件,
/etc/php5/conf.d/目录中复制一个ssh2.ini文件
cp mysql.ini ssh2.ini
编辑ssh2.ini,将其中内容修改为:
extension=ssh2.so
好了,现在重新启动apapche
apache2ctl -k restart
用这个命令php -i|grep ssh2
不出意外,将看到相关信息
/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
呵呵,这个信息表示已经成功了。
下面接下来,就是用php去执行ssh2扩展命令了。
$connection = ssh2_connect("172.16.18.252",22);
if (ssh2_auth_password($connection,"root","123456")) {
echo "Authentication Successful! ";
} else {
die(Authentication Failed...);
}
?>
不出意外,你将看到“Authentication Successful”信息。
呵呵,我就出现了,意外,查询了一下。每次都是出现如下提示:
Authentication Failed...
用户名,密码,这些都没有错误啊。
最后,检查了一下,本机ssh的配置
vi /etc/ssh/sshd_config
发现在:
PasswordAuthentication no
呵呵,修改成:
PasswordAuthentication yes
保存,重新启动ssh
/etc/init.d/sshd restart
呵呵,居然通过了。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

This article introduces free digital asset quotation software apps and websites that can provide investors with key information such as real-time prices, price charts, transaction volume, fluctuations, market depth and news information to help investors make informed decisions. Compared with paid software, free software has the advantages of no cost, rich features, and easy operation. The article also guides users how to choose the right market software, and reminds users to pay attention to data sources, information accuracy and avoid excessive dependence, which ultimately helps investors better grasp the trends of the digital asset market. Want to know how to use free market software efficiently? Read the full text quickly!

Jubi.com CoinCola mobile APP download tutorial and security guide. This article introduces in detail the methods of downloading the CoinCola APP through the official website of Jubi.com, the app store and the invitation link, and provides detailed steps for Android and iOS systems. In addition, the article also emphasizes security precautions during the download process, such as: confirming the official website, checking the APP permissions, updating to the latest version, enabling two-factor verification, and preventing phishing fraud, etc., aiming to help users download and use the Jubi.com APP to conduct digital asset transactions safely and conveniently, and improve user transaction experience.

Choosing the right Bitcoin market viewing software is crucial, it can help investors grasp market conditions in real time and make smarter investment decisions. This article will guide you how to make a choice, covering personal needs assessment (trading frequency, analysis depth, information needs and budget), software type selection (exchange interface, professional software, market website/APP), core functional considerations (data reliability, chart tools, custom settings, community communication and platform compatibility), and direction recommendations (maturity financial platform, cryptocurrency aggregation platform, community recommendation software). Finally, it is recommended that you try a few more software and compare it to choose the tool that best suits your needs. Please remember that software is only an auxiliary tool, and you must be cautious when investing at your own risk.

The OKX trading platform can be downloaded through mobile devices (Android and iOS) and computers (Windows and macOS). 1. Android users can download it from the official website or Google Play, and they need to pay attention to security settings. 2. iOS users can download it through the App Store or follow the official announcement to obtain other methods. 3. Computer users can download the client of the corresponding system from the official website. Always make sure to use official channels when downloading, and register, log in and security settings after installation.

As a veteran cryptocurrency derivatives trading platform, the accuracy of its official website entrance is crucial. Due to rampant phishing websites, misent entry into fake websites can lead to account theft and loss of funds. This article aims to guide users to safely access the BitMEX official website, provide various methods such as trusted cryptocurrency information platforms (such as CoinMarketCap, CoinGecko), official social media, verification of existing addresses and official support channels, and emphasizes the use of security measures such as two-factor verification, regular password changes and use of security software to help users effectively avoid risks and ensure account security.

Gate.io Sesame Open Exchange App Download Guide: This article explains the official Gate.io Exchange App Download Method to help you trade cryptocurrency anytime, anywhere. Gate.io App has the advantages of convenience, good user experience, comprehensive functions (spot, contract, leverage, financial management, etc.) and strong security, and provides real-time market information. To ensure safety, be sure to download the App from the official website of Gate.io to avoid downloading malware. The article introduces the official website download steps and iOS and Android installation procedures in detail, and provides frequently asked questions and security suggestions to help you quickly get started with the Gate.io App and start a safe and convenient cryptocurrency trading journey.

Choosing the right Bitcoin market viewing tool is crucial for investors. This article will introduce several common types of Bitcoin market viewing software, including the exchange's own interface, professional market software and web-based market websites, and analyze its advantages and disadvantages. The exchange comes with its own interface, but its functions are relatively simple; professional software is powerful, but it may require payment and has a high learning cost; web version is convenient and fast, but its functions may not be as powerful as professional software. When choosing, you need to consider factors such as data source reliability, functional requirements, ease of use, expenses, and platform support. At the end of the article, it is recommended to try different software more, combine multi-platform information analysis, and state that this article does not constitute investment advice. Want to know about the Bitcoin market? Read this article quickly and find the best viewing tool for you!

Binance is the world's leading cryptocurrency trading platform, supporting more than 350 cryptocurrencies and more than 1,700 trading pairs, and providing a variety of trading modes such as spot, futures, and leverage. Users can download the APP through the official website and select iOS or Android to install it. Founded in 2017, Binance has developed into a global large exchange, but it also faces settlement of US $4.3 billion in money laundering charges in 2023. Its advantages lie in its strong technical strength, rich product services, a huge user base and strict security measures, including the SAFU insurance fund. Binance also has diversified businesses such as Binance Smart Chain, Research Institute, Academy, and Binance Card.
