Getting Zend / PEAR to work on Ubuntu

So I recently switched over from a shared host (1&1) to a Virtual Private Server ( Linode ). With the VPS you still share a server, but you are in complete control of everything. You have to get things up in running from a blank image. This means installing Apache, PHP and all the other stuff you need. Luckily, Linode has a great library explaining how to do all of this.

It is pretty easy to add different frameworks like Zend & PEAR using the apt-get command. However when I tried porting over a PHP site I wrote that used Zend & PEAR, I got the following error:

[Sun Sep 12 19:27:56 2010] [error] [client] PHP Fatal error: require_once(): Failed opening required ‘Zend/Loader.php’ (include_path=’.:/usr/share/php:/usr/share/pear’)

I looked at phpinfo() and it looked like it was reading in all the php.ini and Zend was working. Unfortuantly, as you can see in error message, the include path wasn’t being set right and wasn’t pulling the libraries.
Turns out that the include_path in the main php.ini has to be updated and point to the location of the libraries.
To fix this I edit /etc/php5/apache2/php.ini and uncommented the include_path line and pointed to the libraries:
;;;;;;;;;;;;;;;;;;;;;;;;; ; Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;;
; UNIX: “/path1:/path2” include_path = “.:/usr/share/php:/usr/share/php/libzend-framework-php:/usr/share/php/PEAR”