Wednesday, October 12, 2011

Where is the Best Place to Install the Zend Framework?

Choosing where you install the Zend Framework is one of the more important decisions you’ll make in your application’s life cycle. Knowing the pro’s and con’s of the different options will allow you to make the most informed (and correct) decision when installing it.
In general there are 3 basic options to consider when choosing where to install the Zend Framework, each with strengths and weaknesses. Which one is right for you depends on your individual situation.

Using the Repositories

This is perhaps the easiest option for installing the Zend Framework. If your server runs on Unix/Linux, the Zend Framework is part of the standard repositories and can be installed with a command similar to the following:
sudo apt-get install zend-framework
A recent version of the Zend Framework will be installed, and made available to your PHP include path, making this an extremely simple way to get started. However, this method has several drawbacks, including:
  • The repo version is not the latest release, so you won’t have access to the newest features
  • If you don’t have shell access to your server, you must rely on others to install and update the Framework
  • If you have several sites using the Zend Framework and you upgrade to a newer release, there is a possibility that some parts of your sites will not be compatible with the new version, effectively breaking those sites all at once, until you can track down all the bugs.
Using the repositories for installation of the Zend Framework is a good beginners strategy, and indeed very easy and fast. If you plan on running anything but the most trivial sites, however, this is not the recommended method.

Installation Available in the Include Path

The second method involves downloading the latest release of the Zend Framework and uploading it to your server in a location accessible to all sites that you run. This means that you upload it to one place, make it available with the include_path directive in php.ini, and away you go. This is similar to the first method in that all websites share the same installation, and to upgrade the Zend Framework, you only need to upgrade in one place.
Using a shared installation approach has advantages over using repositories, such as:
  • You are no longer reliant on system administrators to install the Zend Framework and keep it up to date
  • You control the specific version of the Zend Framework in use. If you want the latest version, you can easily install it by downloading it from Zend
This is a good solution for a small number of simple, non critical websites. However, if you run mission critical applications, or a large number of sites, there is still a better way.

Individual Installations for Each Application

The third, and most flexible, place to install the Zend Framework is individually with every application that uses it. This may seem like excessive overhead, but it has some serious advantages:
  • Control the version of the Zend Framework used by each application, individually. This is extremely important when dealing with upgrades, as newer versions of the Zend Framework may not be 100% compatible with your existing code. It is much better to upgrade one site at a time, searching out and fixing all the bugs. You may find that certain sites don’t need an upgrade at all
  • The site becomes self contained and less reliant on the environment it is run in. If you migrate servers, for example, your sites will ‘just work‘ without the need to install the Zend Framework in the same manner and location that it was previously installed in (in a shared installation approach). Instead, the Zend Framework is contained entirely within the site, and will always be available to it
Generally, the ‘library‘ folder (outside of the public directory) is the best place for the Zend Framework.
Yes the Zend Framework is, in theory, backward compatible with previous versions. This is not always the case, however. The smallest changes to its code can wreak havok on your existing sites, so it is preferrable to upgrade one site at a time, if needed at all. This allows you to setup individual testing environments, fix all the bugs, then make the newest version live on a site by site basis, without risking breaking all of your sites in ways you won’t find out about until 3 months down the road.

Conclusion

Where to install the Zend Framework is a question largely dependent on your needs and the sites you run. Taking a moment to consider the available options will pay off down the road, especially when you’d like to upgrade to a newer version.

No comments:

Post a Comment