Record of the installation process of PHP SSH2 extension in Linux CentOS environment

888u

Last update at :2024-06-17,Edit by888u

Because we need to debug the PHP file that can execute the file in the current Linux server environment and need to run the remote operation SSH process, Mr. P told us that we need to deploy the SSH2 extension in the current server environment before we can compile the SSH script command in the PHP file. So Snail installed the SSH2 extension in the current CentOS environment and recorded it for future reference if needed.

Remarks: If we need to run it directly in a formal environment, it is recommended to debug it in a test machine before using it or back up the data to avoid possible problems.

First, install the support library files

yum install php-devel php-pear libssh2 libssh2-devel -y

Log in to the SSH client directly, then execute the command and press Enter to install the required library files.

Second, install the SSH2 extension

pecl install -f ssh2

Execute the command, and then when you see an input interface, just press Enter.

It will be installed automatically after pressing Enter.

Third, modify ssh2.ini

touch /etc/php.d/ssh2.ini

echo extension=ssh2.so > /etc/php.d/ssh2.ini

Add files into it.

Fourth, check whether SSH2 is installed successfully

php -m | grep ssh2

php -i|grep ssh2

Here, we can see that the SSH2 extension installed on Snail has been completed and successful.

Recommended site search: free registration of website space, free domain name registration, which is the best foreign server rental, free international domain name, Hong Kong server rental, free virtual host server, domain name reservation, free domain name space, registration space, Zhengzhou server

Record of the installation process of PHP SSH2 extension in Linux CentOS environment

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码