PageRenderTime 52ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 1ms

/docs/docbook5/en/source/chapters/settingup.xml

https://github.com/rozwell/phing
XML | 382 lines | 345 code | 37 blank | 0 comment | 0 complexity | 945f8ebe91edef36470cc1f5be781f01 MD5 | raw file
Possible License(s): LGPL-3.0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbookxi.rng"
  3. schematypens="http://relaxng.org/ns/structure/1.0"?>
  4. <chapter xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude"
  5. xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="ch.settingup">
  6. <title>Setting-up Phing</title>
  7. <para>The goal of this chapter is to help you obtain and correctly setup and execute Phing on
  8. your operating system. Once you setup Phing properly you shouldn't need to revisit this
  9. chapter, unless you're re-installing or moving your installation to another platform.</para>
  10. <sect1>
  11. <title> System Requirements </title>
  12. <para>To use Phing you must have installed PHP version 5.2 or above compiled
  13. <literal>--with-libxml2</literal>, as well as <literal>--with-xsl</literal> if you
  14. want to make use of advanced functionality.</para>
  15. <para>For more information on PHP and the required modules see the PHP <link
  16. xlink:href="Bibliography.html#php">[php]</link> website. For a brief list of
  17. software dependencies see below.</para>
  18. <sect2>
  19. <title> Operating Systems </title>
  20. <para>Designed for portability from the get go, Phing runs on all platforms that run PHP. However
  21. some advanced functionality may not work properly or is simply ignored on some
  22. platforms (i.e. <literal>chmod</literal> on the Windows platform).</para>
  23. <para>To get the most out of Phing, a Unix style platform is recommended. Namely: Linux,
  24. FreeBSD, OpenBSD, etc.</para>
  25. </sect2>
  26. <sect2>
  27. <title> Software Dependencies </title>
  28. <para>For a detailed list of required and/or optional software and libraries, refer to the
  29. following table of Software Dependencies.</para>
  30. <para>NB: This list is not exhaustive, please refer to individual Phing tasks to find
  31. out additional software requirements.</para>
  32. <table>
  33. <title>Software Dependencies</title>
  34. <tgroup cols="3">
  35. <colspec colname="c1" colnum="1" colwidth="1*"/>
  36. <colspec colname="c2" colnum="2" colwidth="1*"/>
  37. <colspec colname="c3" colnum="3" colwidth="2*"/>
  38. <thead>
  39. <row>
  40. <entry>Software</entry>
  41. <entry>Required for</entry>
  42. <entry>Source</entry>
  43. </row>
  44. </thead>
  45. <tbody>
  46. <row>
  47. <entry>PHP 5.2+</entry>
  48. <entry>Execution</entry>
  49. <entry><link xlink:href="http://www.php.net" role="external"
  50. >http://www.php.net</link>
  51. </entry>
  52. </row>
  53. <row>
  54. <entry>PHPUnit 3.4.0+</entry>
  55. <entry>Optional; enables additional task(s)</entry>
  56. <entry><link xlink:href="http://www.phpunit.de" role="external"
  57. >http://www.phpunit.de</link>
  58. </entry>
  59. </row>
  60. <row>
  61. <entry>Xdebug 2.0.0+</entry>
  62. <entry>Optional; enables additional task(s)</entry>
  63. <entry><link xlink:href="http://www.xdebug.org" role="external"
  64. >http://www.xdebug.org</link>
  65. </entry>
  66. </row>
  67. <row>
  68. <entry>SimpleTest 1.0.1 beta+</entry>
  69. <entry>Optional; enables additional task(s)</entry>
  70. <entry><link xlink:href="http://simpletest.sourceforge.net"
  71. role="external">http://simpletest.sourceforge.net</link>
  72. </entry>
  73. </row>
  74. <row>
  75. <entry>PhpDocumentor 1.4.0+ (PEAR package)</entry>
  76. <entry>Optional; enables additional task(s)</entry>
  77. <entry><link xlink:href="http://pear.php.net/package/PhpDocumentor"
  78. role="external">http://pear.php.net/package/PhpDocumentor</link>
  79. </entry>
  80. </row>
  81. <row>
  82. <entry>VersionControl_SVN (PEAR package)</entry>
  83. <entry>Optional; enables additional task(s)</entry>
  84. <entry><link xlink:href="http://pear.php.net/package/VersionControl_SVN"
  85. role="external"
  86. >http://pear.php.net/package/VersionControl_SVN</link>
  87. </entry>
  88. </row>
  89. <row>
  90. <entry>VersionControl_Git (PEAR package)</entry>
  91. <entry>Optional; enables additional task(s)</entry>
  92. <entry><link xlink:href="http://pear.php.net/package/VersionControl_Git"
  93. role="external"
  94. >http://pear.php.net/package/VersionControl_Git</link>
  95. </entry>
  96. </row>
  97. <row>
  98. <entry>PHP_CodeSniffer (PEAR package)</entry>
  99. <entry>Optional; enables additional task(s)</entry>
  100. <entry><link xlink:href="http://pear.php.net/package/PHP_CodeSniffer"
  101. role="external"
  102. >http://pear.php.net/package/PHP_CodeSniffer</link>
  103. </entry>
  104. </row>
  105. <row>
  106. <entry>Archive_Tar (PEAR package)</entry>
  107. <entry>Optional; enables additional task(s)</entry>
  108. <entry><link xlink:href="http://pear.php.net/package/Archive_Tar"
  109. role="external">http://pear.php.net/package/Archive_Tar</link>
  110. </entry>
  111. </row>
  112. <row>
  113. <entry>Services_Amazon_S3 (PEAR package)</entry>
  114. <entry>Optional; enables additional task(s)</entry>
  115. <entry><link xlink:href="http://pear.php.net/package/Services_Amazon_S3"
  116. role="external"
  117. >http://pear.php.net/package/Services_Amazon_S3</link>
  118. </entry>
  119. </row>
  120. <row>
  121. <entry>HTTP_Request2 (PEAR package)</entry>
  122. <entry>Optional; enables additional task(s)</entry>
  123. <entry><link xlink:href="http://pear.php.net/package/HTTP_Request2"
  124. role="external">http://pear.php.net/package/HTTP_Request2</link>
  125. </entry>
  126. </row>
  127. <row>
  128. <entry>PHP Depend</entry>
  129. <entry>Optional; enables additional task(s)</entry>
  130. <entry><link xlink:href="http://www.pdepend.org" role="external"
  131. >http://www.pdepend.org</link>
  132. </entry>
  133. </row>
  134. <row>
  135. <entry>PHP Mess Detector</entry>
  136. <entry>Optional; enables additional task(s)</entry>
  137. <entry><link xlink:href="http://www.phpmd.org" role="external"
  138. >http://www.phpmd.org</link>
  139. </entry>
  140. </row>
  141. <row>
  142. <entry>PHP Copy/Paste Detector</entry>
  143. <entry>Optional; enables additional task(s)</entry>
  144. <entry><link xlink:href="http://pear.phpunit.de" role="external"
  145. >http://pear.phpunit.de</link>
  146. </entry>
  147. </row>
  148. <row>
  149. <entry>DocBlox 0.17.0+</entry>
  150. <entry>Optional; enables additional task(s)</entry>
  151. <entry><link xlink:href="http://www.docblox-project.org" role="external"
  152. >http://www.docblox-project.org</link>
  153. </entry>
  154. </row>
  155. </tbody>
  156. </tgroup>
  157. </table>
  158. <warning>
  159. <para>Phing does not work with safe mode enabled in PHP!</para>
  160. </warning>
  161. </sect2>
  162. </sect1>
  163. <sect1>
  164. <title> Obtaining Phing </title>
  165. <para>Phing is free software distributed under the terms of the LGPL.</para>
  166. <sect2>
  167. <title> Distribution Files </title>
  168. <para>There are several ways to get a Phing distribution package. If you do not want to
  169. participate in developing Phing itself it is recommended that you get the latest
  170. snapshot or stable packaged distribution. If you are interested in helping with
  171. Phing development, register an account at GitHub as described below.</para>
  172. <para>The easiest way to obtain the distribution package is to visit the Phing website <link
  173. xlink:href="Bibliography.html#phing">[phing] </link>and download the current
  174. distribution package in the format you desire.</para>
  175. <para>As of version 2.0, you have the option of downloading a PEAR-installable package
  176. or the full phing distribution. If you wish to modify phing we suggestion
  177. downloading the full version so that you can (e.g.) create your own PEAR package. If
  178. you simply wish to use Phing for your own project or need it to build another
  179. package, download &amp; install the PEAR package.</para>
  180. </sect2>
  181. <sect2>
  182. <title>Getting the latest source from Phing Git repository</title>
  183. <para>The latest snapshot can always be downloaded directly the official Phing Git
  184. repository. However, be warned that there is not guarantee that the momentous state
  185. of the repository represents a completely stable application without any
  186. problems.</para>
  187. <para>You can download a snapshot as a zip-tarball from:</para>
  188. <itemizedlist>
  189. <listitem>
  190. <para><link xlink:href="https://github.com/phingofficial/phing"
  191. >https://github.com/phingofficial/phing</link></para>
  192. </listitem>
  193. </itemizedlist>
  194. </sect2>
  195. </sect1>
  196. <sect1>
  197. <title> PEAR Install </title>
  198. <para>The easiest way to install Phing is using the PEAR installer. Provided that the
  199. package you downloaded is a the PEAR-ready package, you can install Phing simply from
  200. the command line (Unix or Windows):</para>
  201. <screen>$&gt; pear channel-discover pear.phing.info
  202. $&gt; pear install phing/phing</screen>
  203. <para>The pear installer will check any dependencies and place the phing script (phing or
  204. phing.bat) into your PHP script directoy (i.e. where the "pear" script resides).</para>
  205. </sect1>
  206. <sect1>
  207. <title> Non-PEAR Install </title>
  208. <para> If you are not using the PEAR installer, you will need to setup your environment in
  209. order to run Phing. The distribution of Phing consists of three directories: <filename
  210. role="dir">bin</filename> , <filename role="dir">docs</filename> and <filename
  211. role="dir">classes</filename>. Only the <filename role="dir">bin</filename>,
  212. <filename role="dir">classes</filename> and <filename role="dir">etc</filename>
  213. directories are required to run Phing. To install Phing, choose a directory and
  214. uncompress the distribution file in that directory (you may already have done this in a
  215. prior step). This directory will be known as <literal>PHING_HOME</literal> .</para>
  216. <warning>
  217. <para>On earlier Windows installations, the script used to launch Phing will have
  218. problems if <literal>PHING_HOME</literal> is a long filepath. This is due to
  219. limitations in the OS's handling of the "for" batch-file statement. It is
  220. recommended, therefore, that Phing be installed in a short path, such as <filename
  221. role="dir">C:\opt\phing</filename>.</para>
  222. </warning>
  223. <para>Before you can run Phing there is some additional set up you will need to do
  224. perform:</para>
  225. <itemizedlist>
  226. <listitem>
  227. <para>Add the full path to the <filename role="dir">bin/</filename> directory to
  228. your path.</para>
  229. </listitem>
  230. <listitem>
  231. <para>Set the <literal>PHING_HOME</literal> environment variable to the directory
  232. where you installed Phing. On some operating systems the Phing wrapper scripts
  233. can guess PHING_HOME (Unix dialects and Windows). However, it is better to not
  234. rely on this behavior.</para>
  235. </listitem>
  236. <listitem>
  237. <para>Set the <literal>PHP_COMMAND</literal> environment variable to where your Php
  238. binary is located (including the binary i.e. PHP_COMMAND=/usr/bin/php).</para>
  239. </listitem>
  240. <listitem>
  241. <para>Set the <literal>PHP_CLASSPATH</literal> environment variable (see the section
  242. below). This should be set at least point to PHING_HOME/classes. Alternatively,
  243. you can also just add the phing/classes directory to your PHP include_path ini
  244. setting.</para>
  245. </listitem>
  246. <listitem>
  247. <para>Check your php.ini file to make sure that you have the following
  248. settings:</para>
  249. <itemizedlist>
  250. <listitem>
  251. <para><code>max_execution_time = 0 // unlimited execution time</code></para>
  252. </listitem>
  253. <listitem>
  254. <para><code>memory_limit = 32M // you may need more memory depending on size
  255. of your build files</code></para>
  256. </listitem>
  257. </itemizedlist>
  258. </listitem>
  259. </itemizedlist>
  260. <para>If you are using Phing in conjunction with another application, you may need to add
  261. additional paths to <literal>PHP_CLASSPATH</literal>.</para>
  262. <sect2>
  263. <title> Unix </title>
  264. <para> Assuming you are running a Unix dialect operating system with the bash bourne
  265. shell and Phing is installed in <filename role="dir">/opt/phing</filename> . The
  266. following sets up the environment properly: </para>
  267. <screen>export PHP_COMMAND=/usr/bin/php
  268. export PHING_HOME=/opt/phing
  269. export PHP_CLASSPATH=${PHING_HOME}/classes
  270. export PATH=${PATH}:${PHING_HOME}/bin</screen>
  271. </sect2>
  272. <sect2>
  273. <title> Windows </title>
  274. <para>On the Windows platform, assuming Phing is installed in <filename role="dir"
  275. >c:\opt\phing</filename>. The following sets up your environment:</para>
  276. <screen>set PHP_COMMAND=c:\opt\php\php.exe
  277. set PHING_HOME=c:\opt\phing
  278. set PHP_CLASSPATH=c:\opt\phing\classes
  279. set PATH=%PATH%;%PHING_HOME%\bin</screen>
  280. </sect2>
  281. <sect2>
  282. <title>Advanced</title>
  283. <para>There are lots of variants that can be used to run/prepare Phing. You need at
  284. least the following:</para>
  285. <itemizedlist>
  286. <listitem>
  287. <para>If you want Phing to be able to use other packages / classes, you can either add them to
  288. the <literal>PHP_CLASSPATH</literal> or to PHP's include_path.</para>
  289. </listitem>
  290. <listitem>
  291. <para>Some Tasks in <filename role="dir">phing/tasks/ext</filename> may require 3rd party
  292. libraries to be installed. Generally, tools with compatible license (and
  293. stable releases) are included in phing/lib so that outside dependencies can
  294. be avoided. PEAR libs will not, however, be bundled with Phing since they
  295. are generally bundled with PHP. If you are using a 3rd party task, see the
  296. Task documentation to be aware of any dependencies.</para>
  297. </listitem>
  298. </itemizedlist>
  299. <para> You are now ready to use the <command>phing</command> command at your command
  300. prompt, from everywhere in your directory tree.</para>
  301. </sect2>
  302. </sect1>
  303. <sect1>
  304. <title> Calling Phing </title>
  305. <para>Now you are prepared to execute Phing on the command line or via script files. The
  306. following section briefly describe how to properly execute phing.</para>
  307. <sect2>
  308. <title> Command Line </title>
  309. <para>Phing execution on the command line is simple. Just change to the directory where
  310. your buildfile resides and type</para>
  311. <screen>$ phing [target [target2 [target3] ...]]</screen>
  312. <para> at the command line (where [target...] are the target(s)
  313. you want to be executed). If no target is specified Phing
  314. will try to execute the default target, as specified in the
  315. <literal>project</literal> tag. When calling multipe targets, Phing
  316. will invoke each target independently of the other targets.
  317. Optionally, you may specify command line arguments as listed in <link
  318. xlink:href="appendixes/AppendixA-FactSheet.html#CommandLineArguments">Appendix
  319. A</link>.</para>
  320. <para> For example, the following command line calls the default buildscript
  321. <filename>build.xml</filename> using the default target with the property
  322. <literal>ftp.upload</literal> set to true.</para>
  323. <screen>$ phing -Dftp.upload=true</screen>
  324. </sect2>
  325. <sect2>
  326. <title>Supported command line arguments</title>
  327. <para>As of version 2.4.9 the following command line arguments are supported</para>
  328. <programlisting> -h -help print this message
  329. -l -list list available targets in this project
  330. -v -version print the version information and exit
  331. -q -quiet be extra quiet
  332. -verbose be extra verbose
  333. -debug print debugging information
  334. -longtargets show target descriptions during build
  335. -logfile &lt;file> use given file for log
  336. -logger &lt;classname> the class which is to perform logging
  337. -f -buildfile &lt;file> use given buildfile
  338. -D&lt;property>=&lt;value> use value for given property
  339. -propertyfile &lt;file> load all properties from file
  340. -find &lt;file> search for buildfile towards the root of the
  341. filesystem and use it
  342. -inputhandler &lt;file> the class to use to handle user input</programlisting>
  343. </sect2>
  344. </sect1>
  345. </chapter>