Setting Up Zend Framework

So it is time to check out Zend Framework seeing how powerful everyone says it is. Setup is a bit annoying in comparison to other “funner” frameworks so I am going to document my findings as I learn. Here’s a guide to getting ZF working on your *nix dev box.

Setting up your environment

Using a SSH client such as Putty – connect to your web server and create a directory in your users home named “bin”

$ cd ~
$ mkdir bin
$ cd bin

Next we need to download a stable copy of Zend Framework via subversion using the following command :

$ svn checkout http://framework.zend.com/svn/framework/standard/branches/release-1.10/

If svn (Subversion) is not installed you can download via wget using the following command :

$ wget http://framework.zend.com/releases/ZendFramework-1.10.3/ZendFramework-1.10.3-minimal.tar.gz

Next we need to untar (decompress) the framework :

$ tar -zxvf ZendFramework-1.10.3-minimal.tar.gz

Rename the decompressed folder :

$ mv ZendFramework-1.10.3-minimal Zend

** Note if you used subversion to acquire Zend Framework – you probably have downloaded the release directory – use the command above replacing the first argument with the release directory name.

Move the scripts from the Zend/bin directory into the ~/bin directory; make them executable; rename zf.sh to just zf (for simplicity) :

$ mv Zend/bin/* .
$ chmod +x zf.sh
$ mv zf.sh zf

The next step is to add the zf script to the users include path, this allows us to use the zf command without having to specify the absolute path. Copy and paste the next 6 lines into your shell :

cat << EOF >> ~/.bashrc
if [ -d ~/bin ] ; then
PATH=~/bin:"\${PATH}"
fi
export PATH
EOF

You must now log out and back in to activate this path. Once you are logged back in you can test the zf command by typing :

$ zf show version

If you see “Zend Framework Version: 1.10.3″ you are ready to start your first project.