If you are not using the PEAR installer, you will need to setup your environment in
order to run Phing. The distribution of Phing consists of three directories: bin
, docs
and classes
. Only the bin
,
classes
and etc
directories are required to run Phing. To install Phing, choose a directory and
uncompress the distribution file in that directory (you may already have done this in a
prior step). This directory will be known as PHING_HOME
.
On earlier Windows installations, the script used to launch Phing will have
problems if PHING_HOME
is a long filepath. This is due to
limitations in the OS's handling of the "for" batch-file statement. It is
recommended, therefore, that Phing be installed in a short path, such as C:\opt\phing
.
Before you can run Phing there is some additional set up you will need to do perform:
Add the full path to the bin/
directory to
your path.
Set the PHING_HOME
environment variable to the directory
where you installed Phing. On some operating systems the Phing wrapper scripts
can guess PHING_HOME (Unix dialects and Windows). However, it is better to not
rely on this behavior.
Set the PHP_COMMAND
environment variable to where your Php
binary is located (including the binary i.e. PHP_COMMAND=/usr/bin/php).
Set the PHP_CLASSPATH
environment variable (see the section
below). This should be set at least point to PHING_HOME/classes. Alternatively,
you can also just add the phing/classes directory to your PHP include_path ini
setting.
Check your php.ini file to make sure that you have the following settings:
max_execution_time = 0 // unlimited execution time
memory_limit = 32M // you may need more memory depending on size
of your build files
If you are using Phing in conjunction with another application, you may need to add
additional paths to PHP_CLASSPATH
.
Assuming you are running a Unix dialect operating system with the bash bourne
shell and Phing is installed in /opt/phing
. The
following sets up the environment properly:
export PHP_COMMAND=/usr/bin/php export PHING_HOME=/opt/phing export PHP_CLASSPATH=${PHING_HOME}/classes export PATH=${PATH}:${PHING_HOME}/bin
On the Windows platform, assuming Phing is installed in c:\opt\phing
. The following sets up your environment:
set PHP_COMMAND=c:\opt\php\php.exe set PHING_HOME=c:\opt\phing set PHP_CLASSPATH=c:\opt\phing\classes set PATH=%PATH%;%PHING_HOME%\bin
There are lots of variants that can be used to run/prepare Phing. You need at least the following:
If you want Phing to be able to use other packages / classes, you can either add them to
the PHP_CLASSPATH
or to PHP's include_path.
Some Tasks in phing/tasks/ext
may require 3rd party
libraries to be installed. Generally, tools with compatible license (and
stable releases) are included in phing/lib so that outside dependencies can
be avoided. PEAR libs will not, however, be bundled with Phing since they
are generally bundled with PHP. If you are using a 3rd party task, see the
Task documentation to be aware of any dependencies.
You are now ready to use the phing command at your command prompt, from everywhere in your directory tree.