PHP Call SVN command Update site method, phpsvn_php tutorial

Source: Internet
Author: User
Tags svn update

PHP calls the SVN command to update the site method, PHPSVN


Want to say write a page can perform SVN upgrade program, the result is not as simple as I think, there are some eyebrows need to pay attention to say.
Use the Apache user account to perform SVN checkout, so that Apache has SVN's link power before it can perform SVN update via the webpage.
Copy the Code code as follows:
Su-s/bin/bash Www-data
Cd/var/www
SVN checkout Http://www.xxx.com/svn/my_site

Add the export LANG=C.UTF-8 Environment declaration before executing the shell command with PHP, otherwise the Error,ubuntu Apache default is lang=c if SVN update encounters Chinese.
The--accept theirs-full parameter is then added for SVN, which is the file version of SVN Server when the conflict occurs
Finally, add 2>&1 to allow PHP to get all the information that contains the error
Copy the Code code as follows:
<?php
Putenv (' Lang=c.utf-8 ');
$result = shell_exec (' svn update--accept theirs-full/var/www/my_site 2>&1 ');
echo nl2br ($result);

http://www.bkjia.com/PHPjc/939416.html www.bkjia.com true http://www.bkjia.com/PHPjc/939416.html techarticle PHP called the SVN command to update the site method, Phpsvn want to say to write a page can be executed SVN upgrade program, the result is not as simple as I think, there are some eyebrows need to pay attention to ...

  • Related Article

    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.