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 ...