Wasp Installation and Configuration


Installation

The WASP framework requires a recent version of PHP 5, some PEAR packages, and the PHP build script tool Phing. The PEAR install tool that is packaged with the last versions of PHP makes WASP installation a snap. Links are provided below to the applicable installation downloads and manuals for reference, however the instructions below should be sufficient in most cases.

Windows users might want to try this version of the guide.

Also, here are some instructions for setting up WASP on Red Hat Enterprise Linux.

PHP 5

WASP is not compatible with versions of PHP prior to version 5.

Download PHP 5 (http://www.php.net/downloads.php)

If you had PHP 4 installed previously, make sure you're using the correct version by running:

$ php -version

Check to make sure your php command is pointing to the right place. You should see similar output to the following:

 PHP 5.0.4 (cli) (built: Apr  4 2005 17:32:28)
 Copyright (c) 1997-2004 The PHP Group
 Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies

If this doesn't work, you may have to run

$ php5 -version


PEAR

PEAR is a distribution system for reusable PHP components. PEAR comes standard with PHP 5 installations, so no installation of pear is necessary.

If you've had PHP 4 installed previously, you may have pear, and pear5. If you have trouble installing packages with pear, try running:

 $ pear5

WASP makes use of some PEAR packages, most notably DB_DataObject for the model layer, and HTML_Template_Flexy for the view/template layer. To install a PEAR package, simply run the pear command with the name of the package you wish to install.

For more information about PEAR, see
Using PEAR

Install the following packages (and any dependencies):

$ pear install Date

$ pear install DB

$ pear install DB_DataObject

$ pear install HTML_Template_Flexy

$ pear install Validate_US 


Phing

Phing is a project build system based on Apache Ant. You can do anything with it that you could do with a traditional build system like GNU make, and its use of simple XML build files and extensible PHP "task" classes make it an easy-to-use and highly flexible build framework.

Phing is used to provide automated configuration, data model object generation, and controller page and module generation. The spirit is very much along the lines of the scripts that Ruby on Rails provides to make creating projects easy.

To Install Phing using PEAR:

$ pear install http://phing.info/pear/phing-current.tgz

For a more Windows friendly install of phing, we recommend downloading the .zip file from this page and following the instructions in the included INSTALL.WIN32 file.

For more information on Phing, visit:

How To Install Phing (http://phing.info/wiki/index.php?node=2)

On UNIX systems, the following environment variables may be useful:

export PHP_COMMAND=/usr/bin/php
export PHING_HOME=/usr/local/php5/
export PHP_CLASSPATH=${PHING_HOME}/lib/php
export PATH=${PATH}:${PHING_HOME}/bin

(replace the paths to those of your particular system)


WASP

The WASP package is also installed using PEAR. Run the following command:

$ pear install http://wasp.sourceforge.net/WASP-1.1.1.tgz

to download and install the 1.1.1 version of WASP.

You can also download and install the latest version of WASP from sourceforge.

Download WASP (http://sourceforge.net/project/showfiles.php?group_id=140810)

To install wasp from the downloaded package, unzip it and run the command:

$ pear install package.xml


Configuration

Configuration of wasp is managed using Phing and a build.properties file. When you create your application, the Phing tool reads your build.properties and builds the correct configuration files for your project.

To create a WASP project run the following command:

phing -buildfile PEAR_DIR/lib/php/data/WASP/build.xml wasp-project

where PEAR_DIR is the location where your PEAR classes are installed. You can find out where this directory is by running:

$ pear config-get php_dir

If all is well, you will see:

Buildfile: /usr/local/php5/lib/php/data/WASP/build.xml

WASP > wasp-project:
Directory to create project in  > 

Input the fully qualified path where your new WASP project will be created. This will create the directory and copy over a build.xml and build.propertiles file to it.

Modify the build.properties file according to your application settings. Here is an example build.properties file.


build.properties

###################
# FILE:	build.properties
# DESC:	wasp project configuration properties file
#
# The properties below are used to configure your wasp application.
# Set these properties to customize your wasp install.
#
# run phing config to regenerate the configuration when these are changed.
##

# The name of the application
app.name=	MyApp

# URL where the application will be publically available
app.url=        http://localhost
app.login=      Login

# Toggle Debug output 
debug.flag=	True

# Toggle for email of error messages
email.flag=	False 

# The email address to send error messages if email.flag=True
error.address=	

# Toggle for wasp logging
log.flag=	True
log.path=	.

session.flag=	True

# URL of the database for this application
database.url=	mysql://user@localhost/database

# Directory where pear packages are installed
pear.dir=	/usr/local/php5/lib/php

The app.name property should be set to the name of your application, and will be the name of the the root directory (located off of the app.dir directory or the wasp directory if not specified) of all modules, chunks, and templates that will be created by the build tool.

The debug.flag property enables output from the Debug::output() method. If this property is set to False, all calls to Debug::output() will be ignored.

The database.url property should be set to the URL of the database that will be used for your project. It is not necessary that you use MySQL however WASP hasn't been thoroughly tested on other databases as of the writing of this article. Theoretically WASP will work on any database that is supported by the PEAR DB_DataObject package.

The pear.dir directory should be set to the path your pear classes reside. Windows users will have to change this property. If your pear directory (on windows) has spaces in it, you'll have to use the ~1 (ex. Progra~1 instead of Program Files) version of the directory name.

If at any point you wish to regenerate the configuration, run the following command:

$ phing config

Submitted by bfioca on Fri, 2005-10-14 09:12.
printer-friendly version | login or register to post comments | 17596 reads