Want to say write a Web 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.
Execute SVN checkout first with Apache user account so Apache has SVN link power to execute SVN update via web page
Copy Code code as follows:
Su-s/bin/bash Www-data
Cd/var/www
SVN checkout Http://www.xxx.com/svn/my_site
Before using PHP to execute shell directives to add export LANG=C.UTF-8 environment statement, or SVN update encountered in Chinese will appear Error,ubuntu Apache default is Lang=c
Next, you want to patch up the--accept theirs-full parameter for SVN, which is the file version of SVN Server when the conflict occurs
Finally, add 2>&1, so that PHP can get all the information that contains the error
Copy 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);