Because you need to debug the php file that can execute files in the current Linux server environment and need to run the SSH process remotely, P always tells us that you need to deploy the SSH2 extension in the current server environment to compile the SSH script command in the PHP file. Therefore, the old left installs the SSH2 extension in the current CentOS environment, which is recorded as follows, for later reference if necessary.
Note: If you need to run the tool directly in the formal environment, we recommend that you debug the tool before using the tool or back up the data to avoid possible problems.
1. Install the support library file
The code is as follows: |
Copy code |
Yum install php-devel php-pear libssh2 libssh2-devel-y
|
Log on to the SSH client directly, and run the command "enter" to install the required library file.
2. Install the SSH2 extension
The code is as follows: |
Copy code |
Pecl install-f ssh2
|
Run the command, and then you can see an input interface. Press Enter.
Press enter to automatically install the SDK.
3. Modify ssh2.ini
The code is as follows: |
Copy code |
Touch/etc/php. d/ssh2.ini
Echo extension = ssh2.so>/etc/php. d/ssh2.ini
|
Add the file.
4. Check whether SSH2 is successfully installed.
The code is as follows: |
Copy code |
Php-m | grep ssh2
Php-I | grep ssh2
|
Here, we can see that the SSH2 extension installed on the left is complete and successful.