Table of Contents
Use Php ssh2 extension to automatically submit svn to the test server, ssh2svn
Home Backend Development PHP Tutorial Use Php ssh2 extension to automatically submit svn to the test server, ssh2svn_PHP tutorial

Use Php ssh2 extension to automatically submit svn to the test server, ssh2svn_PHP tutorial

Jul 12, 2016 am 08:54 AM
svn

Use Php ssh2 extension to automatically submit svn to the test server, ssh2svn

1. Install the ssh2 extension  

(1)window

<span>1</span><span>. 下载 php extension ssh2
下载地址 http:</span>//windows.php.net/downloads/pecl/releases/ssh2/<span>0.12</span>/<span>
根据自己PHP的版本去下载</span><span>2</span><span>. 解压完后,会有三个文件,libssh2.dll、php_ssh.dll、php_ssh2.pdb。
</span><span>3</span>. 将 php_ssh.dll、php_ssh2.pdb 放到你的 php 扩展目录下 php/ext/<span> 下。
</span><span>4</span>. 将libssh2.dll 复制到 c:/windows/system32 和 c:/windows/<span>syswow64 各一份
</span><span>5</span>. php.ini中加入 extension=<span>php_ssh2.dll
</span><span>6</span><span>. 重启服务器,即可使用php执行ssh连接操作了。
查看phpinfo(),是否有显示php_ssh2扩展加载成功。<br /></span>
Copy after login

(2)linux

<span>在linux下需要先安装扩展所需的依赖库
</span><span>1</span><span>.安装libssh2
wget http:</span>//www.libssh2.org/download/libssh2-<span>1.7</span>.<span>0</span><span>.tar.gz
tar zxf libssh2</span>-<span>1.7</span>.<span>0</span><span>.tar.gz
cd libssh2</span>-<span>1.7</span>.<span>0</span><span>
.</span>/configure --prefix=/usr/local/<span>libssh2
make </span>&&<span> make install
</span><span>2</span><span>.安装ssh2
wget http:</span>//pecl.php.net/get/ssh2-<span>0.12</span><span>.tgz
tar </span>-zxvf  ssh2-<span>0.12</span><span>.tgz
cd ssh2</span>-<span>0.12</span><span>
phpize
.</span>/configure --prefix=/usr/local/ssh2 --with-ssh2=/usr/local/<span>libssh2
make
#执行完以上过程后,在当前目录下的modules目录下会生成一个ssh2.so文件,这就是扩展PHP所需要的,将该文件拷贝到PHP库的存储目录下在修改PHP的配置文件即可。
cp modules</span>/ssh2.so /usr/local/php/lib/php/extensions/no-debug-non-zts-<span>20131226</span>/<span>
#注:PHP库的存储目录可能不同
vim </span>/usr/local/php/lib/<span>php.ini
添加extension</span>=<span>ssh2.so
#重启php
php </span>-m |grep ssh #可查看是否安装成功
Copy after login

2. The ssh2 extension is combined with svn to update and delete files and folders

(1) Create the following directory

file stores source code (co code is required for the first time, then use up later)

key stores the key

Log stores error information, file update and delete records

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

(2) Enable hooks in svn hooks, call php script

Say important things three times. You need to change the permissions~ You need to change the permissions~ You need to change the permissions~

svn up status is U D A, use array_pop to pop out useless data

Updates and new additions are of the same category. You need to determine whether it is a file or a folder and choose different functions. It is worth noting ssh2_sftp_mkdir. If this folder exists on the remote machine, an error will be reported

The reason why you use the rm command to delete a folder is because ssh2_sftp_rmdir cannot delete non-empty folders and cannot add parameters

(3) Test submission svn

Update file successfully

If the update speed is slow, blame the network _(┐『ε:)_

Related code: https://github.com/getCodeWarehouse/php_ssh2

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1119059.htmlTechArticleUse Php ssh2 extension to automatically submit svn to the test server, ssh2svn 1. Install the ssh2 extension (1) window 1. Download php extension ssh2 download address http: //windows.php.net/downloads/pecl/releas...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use SVN for version control in PHP development How to use SVN for version control in PHP development Jun 27, 2023 pm 01:39 PM

Version control is a very common operation in PHP development, and the most commonly used tool is SVN (Subversion). It can easily manage historical versions of code and code updates during collaborative development. The following will introduce how to use SVN for version control in PHP development. 1. Install the SVN client and server. First, you need to install the SVN client and server. The SVN client can download the corresponding version from the SVN official website and install it, while the server needs to be built by yourself. The specific method can be

Java SVN: the guardian of the code repository, ensuring code stability Java SVN: the guardian of the code repository, ensuring code stability Mar 09, 2024 am 09:20 AM

Introduction to SVN SVN (Subversion) is a centralized version control system used to manage and maintain code bases. It allows multiple developers to collaborate on code development simultaneously and provides a complete record of historical modifications to the code. By using SVN, developers can: Ensure code stability and avoid code loss and damage. Track code modification history and easily roll back to previous versions. Collaborative development, multiple developers modify the code at the same time without conflict. Basic SVN Operations To use SVN, you need to install an SVN client, such as TortoiseSVN or SublimeMerge. Then you can follow these steps to perform basic operations: 1. Create the code base svnmkdirHttp://exampl

Detailed explanation of how to install and set up the EclipseSVN plug-in Detailed explanation of how to install and set up the EclipseSVN plug-in Jan 28, 2024 am 08:42 AM

Detailed explanation of how to install and set up the EclipseSVN plug-in Eclipse is a widely used integrated development environment (IDE) that supports many different plug-ins to extend its functionality. One of them is the EclipseSVN plugin, which enables developers to interact with the Subversion version control system. This article will detail how to install and set up the EclipseSVN plug-in and provide specific code examples. Step 1: Install the EclipseSVN plug-in and open Eclipse

What is the difference between svn and vss What is the difference between svn and vss Jun 21, 2022 am 11:23 AM

Differences: 1. vss was developed by Microsoft and is paid, while svn is open source and free; 2. vss must have a client, while svn can use the client, command line mode, or read-only on the web page Access; 3. vss only supports windows systems, while svn supports windows and linux systems; 4. vss is a "lock-edit-unlock" mode, and svn defaults to a "modify-conflict-merge" mode; 5. The version number of vss corresponds is a single file, and the version number of svn corresponds to the entire version library.

SVN installation on CentOS and command line installation SVN installation on CentOS and command line installation Feb 13, 2024 am 11:24 AM

Installing SVN on CentOS is a very common operation. It is a powerful version control system that can be used to manage and track changes during software development. This article will introduce in detail how to install SVN on CentOS and provide some commonly used tools. Command line installation method. There are many ways to install SVN on CentOS. Two common installation methods will be introduced below. 1. Open the terminal and log in as the root user. 2. Run the following command to update the system package list: ```yumupdate3. Run the following command to install SVN: yuminstallsubversion4. After the installation is complete, you can verify whether SVN was successfully installed by running the following command: svn --v

Replace svn diff with vimdiff: a tool for comparing code Replace svn diff with vimdiff: a tool for comparing code Jan 09, 2024 pm 07:54 PM

Under Linux, it is very difficult to directly use the svndiff command to view code modifications, so I searched for a better solution on the Internet, which is to use vimdiff as a code viewing tool for svndiff, especially for those who are accustomed to using vim. It is very convenient. When using the svndiff command to compare the modifications of a certain file, for example, if you execute the following command: $svndiff-r4420ngx_http_limit_req_module.c, the following command will actually be sent to the default diff program: -u-Lngx_http_limit_req_module.c(revision4420)-Lngx_

Essential skills for Linux developers: simply master SVN version control Essential skills for Linux developers: simply master SVN version control Jan 26, 2024 pm 09:54 PM

As a Linux developer, you often need to use SVN to control project versions. For excellent developers, knowing how to check SVN versions is undoubtedly one of the essential skills. Today, I would like to take this opportunity to share my experience with you, hoping to help you better master this practical skill. 1. To install the SVN command line tool, please install the SVN command line tool in the Linux environment first! Please dial the terminal and then safely enter the following command to complete the installation: ```Dear user, please execute sudoapt-getinstallsubversion to install Subversion. 2. Connect to the SVN server After the installation is complete, we need to connect to the SVN server. Enter the following command:

Getting Started with PHP: SVN Version Management Getting Started with PHP: SVN Version Management May 20, 2023 am 08:29 AM

As a commonly used server-side scripting language, PHP is widely used in the field of Web development due to its open source and cross-platform advantages. In the development of multi-person collaboration, version control is an indispensable tool. It can effectively manage the modification and update of source code and avoid conflicts caused by code out-of-synchronization among team members. As a popular version control tool, SVN is also widely used in PHP development. This article will introduce you to the basic knowledge of SVN version control in PHP development, including the installation of SVN.

See all articles