PHP自動部署

來源:互聯網
上載者:User
多人開發項目的時候不用自動部署,光維護就是一個非常大的負擔,每次修改項目部署的時候總是小心翼翼,痛苦

為了減負,決定搞phing+xinc來實現自動部署

安裝非常簡單:(pear都沒裝的自己GOOGLE啦)

pear channel-discover pear.phing.info

pear install phing/phing

半年前就是alpha狀態的svn包,到現在還沒發布正式版,暈,估計沒戲了.

執行 pear install pear/VersionControl_SVN

報錯:(略)
pear install channel://pear.php.net/VersionControl_SVN-0.3.1

OK搞定

在裝個FTP支援,需要net_ftp包

pear install Net_FTP
phing基本的都OK啦

現在需要寫個build.xml部署檔案,給個詳細教程,其實跟ant的差不多

View Code

1
2
3 < project name ="lap" basedir ="." default ="help" >
4
5 < property name ="urlRepos" value ="svn://192.168.0.124/obj1" />
6 < property name ="todir" value ="./a" />
7
8 < echo msg ="obj start..." />
9
10 < target name ="help" >
11 < echo >
12 這樣寫的好處可以讓人根據協助來編譯檔案.
13
14
15 < target name ="build" >
16 ....
17
18
19 < target name ="prepare" depends ="build" >
20
21
22 < svncheckout username ="lonely" password ="ls880115" svnpath ="/usr/bin/svn" repositoryurl ="${urlRepos}" todir ="${todir}" />
23
24 < chmod mode ="0777" >
25 < fileset dir ="${todir}" />
26
27
28 < mkdir dir ="./b" />
29
30 < copy todir ="./b" >
31 < fileset dir ="${todir}" >
32 < include name ="b/**" />
33
34
35
36 < zip destfile ="./b/a.zip" >
37 < fileset dir ="${todir}" >
38 < include name ="b/**" />
39
40
41
42 < delete dir ="${todir}" />
43
44 < ftpdeploy host ="192.168.0.5" port ="21" username ="lonely" password ="ls880115" dir ="a" mode ="ascii" clearfirst ="true" >
45 < fileset dir ="./b" >
46 < include name ="**" />
47
48
49
50
51

想要什麼自己編寫部署檔案

以上部分安裝完畢每次提交都得手動運行命令,需要一個自動的,需要安裝xinc

安裝:

pear channel-discover pear.elektrischeslicht.de
pear channel-discover components.ez.no
pear install VersionControl_SVN-alpha
pear install Xinc/xinc-alpha

pear run-scripts xinc/Xinc

啟動:

service xinc start

報錯等級修改為:E_ALL & ~E_NOTICE

如果是5.3以後的PHP需要修改:

/usr/local/php/lib/php/PEAR/Config.php

line:1026 set_magic_quotes_runtime(0) =>ini_set("magic_quotes_runtime",0);

line:1033 set_magic_quotes_runtime($rt) =>ini_set("magic_quotes_runtime",$rt);

安裝完畢

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.