Phpssh2 extended application

Source: Internet
Author: User
Phpssh2 extended application 1. install the ssh2 extension  

(1) window

1. Download php extension ssh2 Extensions. after decompression, there will be three files, libssh2.dll, php_ssh.dll, and php_ssh2.pdb. 3. put php_ssh.dll and php_ssh2.pdb in your php extension directory php/ext. 4. copy libssh2.dll to c:/windows/system32 and c:/windows/syswow64. php. add extension = php_ssh2.dll6 to ini. restart the server and use php to perform ssh connection. Check whether phpinfo () is successfully loaded.

(2) linux

In linux, you must first install the dependent libraries required for extension 1. install libssh2wget http://www.libssh2.org/download/libssh2-1.7.0.tar.gztar zxf libssh2-1.7.0.tar.gzcd libssh2-1.7.0. /configure -- prefix =/usr/local/libssh2make & make install2. install ssh2wget http://pecl.php.net/get/ssh2-0.12.tgztar-zxvf ssh2-0.12.tgzcd ssh2-0.12phpize. /configure -- prefix =/usr/local/ssh2 -- with-ssh2 =/usr/local/libssh2make # After the above process is executed, A ssh2.so file is generated under the modules directory in the current directory. As required by HP, copy the file to the storage directory of the PHP library and modify the PHP configuration file. Cp modules/ssh2.so/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/# note: the storage directory of the PHP library may be different from vim/usr/local/php/lib/php. ini added extension = ssh2.so # restart phpphp-m | grep ssh # check whether the installation is successful

2. integrate the ssh2 extension with svn to update and delete file folders

(1) create the following Directory

File to store the source code (co code is required for the first time, and then use up)

Key storage key

Log stores error information and file update and deletion records

Svn storage related operations (https://github.com/getCodeWarehouse/php_ssh2)

(2) enable the hook in svn hooks and call the php script

The important thing is to change the permission three times ~ To change the permission ~ To change the permission ~

Svn up status has u d a, and useless data is popped up using array_pop

When updating and adding a folder, you need to determine whether it is a file or a folder and select different functions. Note that ssh2_sftp_mkdir will report an error if the folder exists on the remote machine.

The rm command is used to delete a folder because ssh2_sftp_rmdir cannot delete non-empty folders or add parameters.

(3) submit svn for testing

File updated

If the update speed is slow, it blame the network _ (refer "ε :) _ related code: https://github.com/getCodeWarehouse/php_ssh2.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.