UPDATE!!
For the new Zend Framework 1.8.x series, please refer to this article. This is still here for historical purposes.
This is a pretty simple howto, but here it is anyway!
I assume already that you’ve got a LAMP stack working, and if you don’t, it’s easy as pie to install one in Ubuntu:
sudo tasksel install lamp-server
So now you’ve got your LAMP stack up and running, lets download the latest SVN tag of Zend Framework. At the time of writing, the latest stable is 1.7.8, which I’ll use here. If you want to check for the latest version, visit http://framework.zend.com/svn/framework/standard/tags/ in your browser, and the last folder is the one you want. If you want stable full releases, ignore the RC/PR versions. So, once you’ve determined the version you want, we’ll check out the release:
cd /usr/share/php5
sudo mkdir ZendFramework
sudo svn co http://framework.zend.com/svn/framework/standard/tags/release-1.7.8/
It is likely you’ll need to use sudo for these commands as /usr/share/php5 is owned by root by default. You’ll see a big long list of files being checked out, and once that’s done you’ll have a new folder appropriately named “release-1.7.8″. Create a soft link called “current” to the release folder so you can change the default included Zend Framework version without restarting Apache in the future:
sudo ln -s release-1.7.8 current
You can stop there if you like, and manually add the include path into your PHP scripts using set_include_path. However, if you would like the current Zend Framework included automatically, then continue by opening /etc/php5/apache2/php.ini in your favourite editor. Add the path to your include_path list. For example, if your current include_path is (and this is the default):
include_path = ".:/usr/share/php5:/usr/share/pear"
Then change it to:
include_path = ".:/usr/share/php5:/usr/share/pear:/usr/share/php5/ZendFramework/current/library"
All you need to do now is restart Apache:
/etc/init.d/apache2 restart
In the future, if you wish to change to a new default Zend Framework version (for example 1.8.0), then just check out the SVN directory and change the soft link. You won’t even have to restart Apache, and the changes will take effect immediately! For example:
sudo svn co http://framework.zend.com/svn/framework/standard/tags/release-1.8.0/
sudo rm current
sudo ln -s release-1.8.0 current
If you want to keep up to date with the latest Zend software, then just subscribe to their RSS feed!