Share two SVN build test server method

Source: Internet
Author: User

This section and you learn how to use SVN to build a test server, there are two commonly used methods, here is a brief introduction, Welcome to join me to learn SVN build test server method.
In the regular team development process, test server testing is an essential link, how to quickly and easily deploy test server will be the focus of this article. The actual environment of this article is CENTOS+PHP+MYSQL+SVN, and there are two different ways to achieve the ultimate goal of deploying a test server. Let's take a look at SVN's first way to build a test server.
The first kind, post-commit
The post-commit itself is one of the SVN series hooks to make it easier to handle common operations in SVN usage, and the steps to establish a test server are as follows
In the hooks directory, create the Post-commit file and define its contents as similar to the following
Copy code code as follows:

The code is as follows Copy Code
#!/bin/sh
Exportlang=en_us. UTF-8
Svncheckout--usernamekimi--passwordpasswordsvn://10.0.0.8/projects//wwwroot/projects.ismole.net
Chownwww:www/wwwroot/projects.ismole.net-rf

Description:
1.#!/bin/sh Description is the execution of the shell command
2.exportlang=en_us. UTF-8 is to solve Svnpostcommit Chinese garbled, set localization code. But SVN defaults to UTF-8 encoding. If the character set matches and is not set, an error is performed and the execution is unsuccessful with the error identified as Svn:can ' tconvertstringfromnativeencodingto ' utf-8′
3.svncheckout–usernamekimi –passwordpasswordsvn://10.0.0.8/projects//wwwroot/projects.ismole.net perform the SVN checkout operation
4.chownwww:www/wwwroot/ PROJECTS.ISMOLE.NET-RF Change the folder owner for webserver. The original code in the
is all commented out. Here you can execute the shell command, which is invoked every time a commit completes. Let's take a look at SVN's second approach to building a test server.
The second, PHP check out SVN
Copy code as follows:

The code is as follows Copy Code
<?php
Header ("Cache-control:no-cache,must-revalidate");
$handle =popen (' svncheckout--usernamekimi--passwordpasswordsvn://10.0.0.8/projects//wwwroot/projects.ismole.net ', ' r ');
$read =stream_get_contents ($handle);
echo "<pre>";
printf ($read);
echo "</pre>"
Pclose ($handle);
?>

In fact, this way is only using PHP to execute Linux commands, but more description. Refer to "PHP monitoring Linux server load":

The

Http://www.111cn.net combines the above two ways, and is designed to be done by checking out SVN and placing it in the appropriate web directory. These two comparisons, post-commit more simple and fast, no need for more operations, but the control of the authority is very small, as long as SVN submit permissions on the deployment of the test server permissions; PHP is a bit more cumbersome, but the control of user rights can be customized to implement the program, You can achieve almost any role control over permissions.

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.