php实现webhook自动部署代码

 

 

 

简单利用coding结合git实现webhookphp

 

1.建立webhook.phplinux

   确保服务器上能以ssh方式进行git pull操做git

确保shell_exec能执行,在php.ini中 disable_functions 中去掉 shell_exec
<?php

$pwd = getcwd();
$command = 'cd ' . $pwd . ' && git pull';
$output = shell_exec($command);
print $output;

?>

2.设置权限web

   linux服务器上项目默认权限是root用户,而用户访问webhook.php的权限是www,www是没有权限执行git pull操做的,因此须要改变项目全部者权限shell

chown -R www catalogue 

 

3.coding配置webhook设置服务器

相关文章
相关标签/搜索