码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2014-08-02 18:14:43      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   使用   io   文件   ar   

想通过本地提交代码到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 文件路径

修改

使用SVN钩子运行PHP更新服务器代码的注意事项,布布扣,bubuko.com

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

标签:style   blog   http   color   使用   io   文件   ar   

原文地址:http://www.cnblogs.com/gachal/p/3887209.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!