PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/phingofficial/phing
XML | 375 lines | 338 code | 37 blank | 0 comment | 0 complexity | 6c4d1e5ca7802bde008028cb282190e5 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.6.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.5+</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 2.0.0b7+ (PEAR package)</entry>
  76. <entry>Optional; enables additional task(s)</entry>
  77. <entry><link xlink:href="http://pear.phpdoc.org"
  78. role="external">http://pear.phpdoc.org</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. </tbody>
  149. </tgroup>
  150. </table>
  151. <warning>
  152. <para>Phing does not work with safe mode enabled in PHP!</para>
  153. </warning>
  154. </sect2>
  155. </sect1>
  156. <sect1>
  157. <title> Obtaining Phing </title>
  158. <para>Phing is free software distributed under the terms of the LGPL.</para>
  159. <sect2>
  160. <title> Distribution Files </title>
  161. <para>There are several ways to get a Phing distribution package. If you do not want to
  162. participate in developing Phing itself it is recommended that you get the latest
  163. snapshot or stable packaged distribution. If you are interested in helping with
  164. Phing development, register an account at GitHub as described below.</para>
  165. <para>The easiest way to obtain the distribution package is to visit the Phing website <link
  166. xlink:href="Bibliography.html#phing">[phing] </link>and download the current
  167. distribution package in the format you desire.</para>
  168. <para>As of version 2.0, you have the option of downloading a PEAR-installable package
  169. or the full phing distribution. If you wish to modify phing we suggestion
  170. downloading the full version so that you can (e.g.) create your own PEAR package. If
  171. you simply wish to use Phing for your own project or need it to build another
  172. package, download &amp; install the PEAR package.</para>
  173. </sect2>
  174. <sect2>
  175. <title>Getting the latest source from Phing Git repository</title>
  176. <para>The latest snapshot can always be downloaded directly the official Phing Git
  177. repository. However, be warned that there is not guarantee that the momentous state
  178. of the repository represents a completely stable application without any
  179. problems.</para>
  180. <para>You can download a snapshot as a zip-tarball from:</para>
  181. <itemizedlist>
  182. <listitem>
  183. <para><link xlink:href="https://github.com/phingofficial/phing"
  184. >https://github.com/phingofficial/phing</link></para>
  185. </listitem>
  186. </itemizedlist>
  187. </sect2>
  188. </sect1>
  189. <sect1>
  190. <title> PEAR Install </title>
  191. <para>The easiest way to install Phing is using the PEAR installer. Provided that the
  192. package you downloaded is a the PEAR-ready package, you can install Phing simply from
  193. the command line (Unix or Windows):</para>
  194. <screen>$&gt; pear channel-discover pear.phing.info
  195. $&gt; pear install phing/phing</screen>
  196. <para>The pear installer will check any dependencies and place the phing script (phing or
  197. phing.bat) into your PHP script directoy (i.e. where the "pear" script resides).</para>
  198. </sect1>
  199. <sect1>
  200. <title> Non-PEAR Install </title>
  201. <para> If you are not using the PEAR installer, you will need to setup your environment in
  202. order to run Phing. The distribution of Phing consists of three directories: <filename
  203. role="dir">bin</filename> , <filename role="dir">docs</filename> and <filename
  204. role="dir">classes</filename>. Only the <filename role="dir">bin</filename>,
  205. <filename role="dir">classes</filename> and <filename role="dir">etc</filename>
  206. directories are required to run Phing. To install Phing, choose a directory and
  207. uncompress the distribution file in that directory (you may already have done this in a
  208. prior step). This directory will be known as <literal>PHING_HOME</literal> .</para>
  209. <warning>
  210. <para>On earlier Windows installations, the script used to launch Phing will have
  211. problems if <literal>PHING_HOME</literal> is a long filepath. This is due to
  212. limitations in the OS's handling of the "for" batch-file statement. It is
  213. recommended, therefore, that Phing be installed in a short path, such as <filename
  214. role="dir">C:\opt\phing</filename>.</para>
  215. </warning>
  216. <para>Before you can run Phing there is some additional set up you will need to do
  217. perform:</para>
  218. <itemizedlist>
  219. <listitem>
  220. <para>Add the full path to the <filename role="dir">bin/</filename> directory to
  221. your path.</para>
  222. </listitem>
  223. <listitem>
  224. <para>Set the <literal>PHING_HOME</literal> environment variable to the directory
  225. where you installed Phing. On some operating systems the Phing wrapper scripts
  226. can guess PHING_HOME (Unix dialects and Windows). However, it is better to not
  227. rely on this behavior.</para>
  228. </listitem>
  229. <listitem>
  230. <para>Set the <literal>PHP_COMMAND</literal> environment variable to where your Php
  231. binary is located (including the binary i.e. PHP_COMMAND=/usr/bin/php).</para>
  232. </listitem>
  233. <listitem>
  234. <para>Set the <literal>PHP_CLASSPATH</literal> environment variable (see the section
  235. below). This should be set at least point to PHING_HOME/classes. Alternatively,
  236. you can also just add the phing/classes directory to your PHP include_path ini
  237. setting.</para>
  238. </listitem>
  239. <listitem>
  240. <para>Check your php.ini file to make sure that you have the following
  241. settings:</para>
  242. <itemizedlist>
  243. <listitem>
  244. <para><code>max_execution_time = 0 // unlimited execution time</code></para>
  245. </listitem>
  246. <listitem>
  247. <para><code>memory_limit = 32M // you may need more memory depending on size
  248. of your build files</code></para>
  249. </listitem>
  250. </itemizedlist>
  251. </listitem>
  252. </itemizedlist>
  253. <para>If you are using Phing in conjunction with another application, you may need to add
  254. additional paths to <literal>PHP_CLASSPATH</literal>.</para>
  255. <sect2>
  256. <title> Unix </title>
  257. <para> Assuming you are running a Unix dialect operating system with the bash bourne
  258. shell and Phing is installed in <filename role="dir">/opt/phing</filename> . The
  259. following sets up the environment properly: </para>
  260. <screen>export PHP_COMMAND=/usr/bin/php
  261. export PHING_HOME=/opt/phing
  262. export PHP_CLASSPATH=${PHING_HOME}/classes
  263. export PATH=${PATH}:${PHING_HOME}/bin</screen>
  264. </sect2>
  265. <sect2>
  266. <title> Windows </title>
  267. <para>On the Windows platform, assuming Phing is installed in <filename role="dir"
  268. >c:\opt\phing</filename>. The following sets up your environment:</para>
  269. <screen>set PHP_COMMAND=c:\opt\php\php.exe
  270. set PHING_HOME=c:\opt\phing
  271. set PHP_CLASSPATH=c:\opt\phing\classes
  272. set PATH=%PATH%;%PHING_HOME%\bin</screen>
  273. </sect2>
  274. <sect2>
  275. <title>Advanced</title>
  276. <para>There are lots of variants that can be used to run/prepare Phing. You need at
  277. least the following:</para>
  278. <itemizedlist>
  279. <listitem>
  280. <para>If you want Phing to be able to use other packages / classes, you can either add them to
  281. the <literal>PHP_CLASSPATH</literal> or to PHP's include_path.</para>
  282. </listitem>
  283. <listitem>
  284. <para>Some Tasks in <filename role="dir">phing/tasks/ext</filename> may require 3rd party
  285. libraries to be installed. Generally, tools with compatible license (and
  286. stable releases) are included in phing/lib so that outside dependencies can
  287. be avoided. PEAR libs will not, however, be bundled with Phing since they
  288. are generally bundled with PHP. If you are using a 3rd party task, see the
  289. Task documentation to be aware of any dependencies.</para>
  290. </listitem>
  291. </itemizedlist>
  292. <para> You are now ready to use the <command>phing</command> command at your command
  293. prompt, from everywhere in your directory tree.</para>
  294. </sect2>
  295. </sect1>
  296. <sect1>
  297. <title> Calling Phing </title>
  298. <para>Now you are prepared to execute Phing on the command line or via script files. The
  299. following section briefly describe how to properly execute phing.</para>
  300. <sect2>
  301. <title> Command Line </title>
  302. <para>Phing execution on the command line is simple. Just change to the directory where
  303. your buildfile resides and type</para>
  304. <screen>$ phing [target [target2 [target3] ...]]</screen>
  305. <para> at the command line (where [target...] are the target(s)
  306. you want to be executed). If no target is specified Phing
  307. will try to execute the default target, as specified in the
  308. <literal>project</literal> tag. When calling multipe targets, Phing
  309. will invoke each target independently of the other targets.
  310. Optionally, you may specify command line arguments as listed in <link
  311. xlink:href="appendixes/AppendixA-FactSheet.html#CommandLineArguments">Appendix
  312. A</link>.</para>
  313. <para> For example, the following command line calls the default buildscript
  314. <filename>build.xml</filename> using the default target with the property
  315. <literal>ftp.upload</literal> set to true.</para>
  316. <screen>$ phing -Dftp.upload=true</screen>
  317. </sect2>
  318. <sect2>
  319. <title>Supported command line arguments</title>
  320. <para>As of version 2.4.9 the following command line arguments are supported</para>
  321. <programlisting> -h -help print this message
  322. -l -list list available targets in this project
  323. -v -version print the version information and exit
  324. -q -quiet be extra quiet
  325. -verbose be extra verbose
  326. -debug print debugging information
  327. -longtargets show target descriptions during build
  328. -logfile &lt;file> use given file for log
  329. -logger &lt;classname> the class which is to perform logging
  330. -f -buildfile &lt;file> use given buildfile
  331. -D&lt;property>=&lt;value> use value for given property
  332. -propertyfile &lt;file> load all properties from file
  333. -find &lt;file> search for buildfile towards the root of the
  334. filesystem and use it
  335. -inputhandler &lt;file> the class to use to handle user input</programlisting>
  336. </sect2>
  337. </sect1>
  338. </chapter>