Setting Up Zend Framework

I still see some people having a hard time using Zend Framework, so i’ll share some of my experience using ZF. Hope this will help.

Let’s start with the easy and basic one, setting up ZF. There’s two simple way of doing this:

First, download the latest stable release here. It’s available in both .zip and .tar.gz formats. Extract the files.

Second, once you have a copy of the ZF available, your application needs to be able to access the framework classes (in library/Zend folder). There are several ways to do this, but assuming you don’t have control over PHP configuration in your server all you need to do is using set_include_path function to include the ZF classes.

If you’re using Linux,

set_include_path(get_include_path().":library");

or in Windows,

set_include_path(get_include_path().";library");

or you can make your apps compatible with both OS, by determining the path separator, like this:

if ( ! defined( "PATH_SEPARATOR" ) ) {
  if ( strpos( $_ENV[ "OS" ], "Win" ) !== false )
    define( "PATH_SEPARATOR", ";" );
  else
    define( "PATH_SEPARATOR", ":" );
}

set_include_path(get_include_path() . PATH_SEPARATOR . "library");

That’s it, you’re set to go.

Leave a comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.