Call the SVN command in PHP to update the Web site method (resolves a file name that contains a Chinese update failure problem)

Source: Internet
Author: User
Tags svn update

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.

Su-s/bin/bash www-data     /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

<? PHP      putenv (' lang=c.utf-8 ');  Set the locale variable to resolve the problem   caused by the Chinese name in svn update $resultshell_exec(' SVN update--accept theirs-full/var/ Www/my_site 2>&1 ');      Echo NL2BR ($result);    

Call the SVN command in PHP to update the Web site method (resolves a file name that contains a Chinese update failure problem)

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.