php實現webhook自動部署代碼


 

 

 

簡單利用coding結合git實現webhook

 

1.創建webhook.php

   確保服務器上能以ssh方式進行git pull操作

確保shell_exec能執行,在php.ini中 disable_functions 中去掉 shell_exec
<?php

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

?>

2.設置權限

   linux服務器上項目默認權限是root用戶,而用戶訪問webhook.php的權限是www,www是沒有權限執行git pull操作的,所以需要改變項目所有者權限

chown -R www catalogue 

 

3.coding配置webhook設置


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM