2. Installation

2.1. PEAR

Agavi uses a PEAR Channel for release distribution. In order to be able to install releases via PEAR, you have to discover the Agavi PEAR Channel first:

pear channel-discover pear.agavi.org

Now you're ready to install Agavi:

pear install agavi/agavi

You now probably see an error message telling you that PEAR was unable to install Phing. Agavi needs Phing, and tries to install it, but this will fail if it doesn't know Phing's Channel Server yet. Since discovering channels gets massively annoying over time, you can tell PEAR to automatically add channels as it comes across them:

pear config-set auto_discover 1

If you want to install all dependencies (i.e. including Creole and Propel), type:

pear install --alldeps agavi/agavi

If you're still having trouble installing things, you might have to change your preferred state setting in PEAR:

pear config-set preferred_state beta

Also, it is possible to obtain a specific version of Agavi:

pear install agavi/agavi-0.11.0

Tip

Depending on your system configuration, you might need to run these commands with superuser rights. This is, for instance, often the case with PEAR installs on Mac OS X. You can simply prepend sudo to each command to run it with the appropriate permissions.

2.2. By Hand

Installing Agavi by hand is the logical choice if you can't use PEAR, or if you want to bundle Agavi with your application. Go to the Downloads section on the Agavi website to get a release. After unpacking the archive, you can put the src folder into a folder of your choice and adjust your include path accordingly. Don't forget to copy etc/agavi-dist or etc/agavi.bat-dist script to an agavi or agavi.bat executable into a convenient location so you can use the shell commands for creating projects, modules, actions etc. Keep in mind that you must edit the script and enter the path to your Agavi installation (that's the src folder you copied earlier) so everything works as intended.

The more usual case, however, will be that you're shipping Agavi together with your application, either because you can't use Phing to install Agavi in the production environment, or because you want total control over what version of Agavi is used. In this case, copy the src folder to somewhere inside your application's directory structure (we recommend a libs folder that holds all libraries your app uses and that sits on the same level as the app and pub directories) and give it a different name, agavi would stand to reason. For that little extra something, copy the agavi-dist or agavi.bat-dist script again, maybe to your application root. Your pub/index.php can then be changed to use a relative path for including agavi.php, in our case that'd be ../libs/agavi/agavi.php. Agavi will auto-determine and remember the path where it was loaded from, and works without any changes to your environment's include path.

2.3. From SVN

Public access to the Subversion repository is possible via http://svn.agavi.org/. If you want to get the bleeding edge version, use /trunk. Specific releases are available through /agavi/tags. Also, you can get development versions of version branches (if applicable) via /agavi/branches.

Note

Note that trunk might not always give you the latest version of Agavi. For example, once 0.11 RC1 was released, development moved over to branches/0.11, and trunk was not maintained until the final 0.11 release, when work on 1.0 started in trunk.

You can either perform an svn checkout, which creates .svn folders that allow you to stay up to date on changes in the repository via svn update, or you can simply svn export the contents of the repository without Subversion control folders, which is a good idea for example when you want to export a specific release into your own versioning control system.

Once you have obtained a copy from the repository, you can either follow the instructions in By Hand, or you package a PEAR release yourself for local installation by first running

pear channel-discover pear.agavi.org

phing package-pear

on the root directory of your checkout, followed by a

pear package

inside the build directory created by the first command. This will write a .tgz file which can be installed using PEAR. If you already have Agavi installed it might be a good idea to remove it by running pear uninstall agavi/agavi.

2.4. Apache Web Server Configuration

Agavi doesn't require any changes to your Apache configuration.

If you want to use the Routing without an index.php part in the URL path, you need mod_rewrite enabled, along with the respective AllowOverride options set. Refer to the "Removing the "index.php" Part From URLs" section in the Cookbook for further instructions.

2.5. LightTPD Configuration

Agavi doesn't require any changes to your Lighty configuration.

If you want to use the Routing without an index.php part in the URL path, you need the rewrite module enabled. Refer to the "Removing the "index.php" Part From URLs" section in the Cookbook for further instructions.

Tip

You may run into issues when using aliases via alias.url. If routes are generated wrong or you see other error messages, disable(!) the broken-scriptfilename directive.

2.6. Microsoft IIS Configuration

Agavi doesn't require any changes to your IIS configuration.

If you want to use the Routing, you'll have to disable a feature of IIS that checks if a file exists before trying to execute it. To do that, follow these steps:

  1. Go to Control Panel -> Administrative Tools -> Internet Information Services

  2. Pick your Website entry from the list, right-click it, and select Properties

  3. Choose the Home Directory tab

  4. Click the Configuration... button near the bottom right of the box

  5. Select the .php extension entry in the list and click the Edit button

  6. Disable the checkbox that controls the checking for file existance function in the bottom left

If you want to use the Routing without an index.php part in the URL path, you need a plugin for IIS that mimics mod_rewrite's behavior, such as ISAPI_Rewrite. Refer to the "Removing the "index.php" Part From URLs" section in the Cookbook for further instructions.