使用SVN钩子运行PHP更新服务器代码的注意事项

想通过本地提交代码到SVN服务器,同时同步测试服务器的代码

使用SVN钩子,运行服务器的php文件

代码如下:

<?php
header("Content-Type: text/html; charset=utf-8");
header("Cache-Control:no-cache,must-revalidate");

$username = '用户名';    
$password = '密码';    
$target_dir = '路径';    
     
exec("sudo svn up --username $username --password $password $target_dir 2>&1", $output);  
print_r($output);
?>

 

 

注意事项

1.存放php文件的路径需有写的权限,最简单就是设为777

2.参考http://aben328.iteye.com/blog/1070850

之前出现Can't open file Permission denied的错误

使用ll 文件路径/.svn,发现用户都是root

可以使用chown –R apache:apache 文件路径

修改

posted @ 2014-08-02 17:03  扎克  阅读(954)  评论(0编辑  收藏  举报