Set Include Path

The best way to set the include path on the fly inside PHP is to add to whatever the current php include path is. I know for the Zend Framework, even if you include the first class, if the path to the Zend Library is not in the include path, then Zend will not be able to include dependent classes and you will get an error. So let’s say you want to include a Zend library, and it is located at /var/www/vhosts/www.domain.com/library/Zend/ if you add the include path right before you include teh first Zend Framework Class, as follows, it should work for you.

set_include_path(get_include_path() . PATH_SEPARATOR . '/var/www/vhosts/www.domain.com/library/');

About this entry