On my server, the default include path of PHP looks like this:
I recently upgraded the Zend libarary in /opt/zend to 1.8.2 and got this error in the Piwik.org Blog plugin:
File "Com.php" was loaded but class "Zend_Validate_Hostname_Com" was not found in the file
After I removed /opt/zend from the include path for Piwik's virtual host, the error was gone.
It seems that Piwik somehow handles inclusion of the Zend library in the wrong way. If Piwik handled the include path correctly, there should be no interference of the library in /opt/zend with the one shipped by Piwik, because the working directory (".") is always checked first.
Are ini_set() or set_include_path() disabled in your php configuration?
In 0.4's piwik/index.php and piwik/piwik.php, any existing include path is appended to the absolute paths specified by Piwik (eg PIWIK_INCLUDE_PATH . '/core').
I did a little debugging: In libs/Zend/Validate/Hostname/Hostname.php is a line (no. 325), that tries to load the file Zend/Validate/Hostname/$tld.php, if Zend_Loader->isReadable($file) is true. Zend_Loader->isReadable() checks for each directory in the include path, if such a file exists and returns true, if it exists and a class exists in the file. If the file exists, but a class does not exist, it throws the exeception I encountered above.
To be fair, this is really a problem with Zend_Framework and not with Piwik. On the other hand, this wouldn't be a problem, if Piwik did not append the preset include path in /index.php like you pointed out above. There isn't really a reason to do that, I think. So my suggestion would be: Know where you need to include. Put that in the include path. Ditch everything else.
It's not that simple, but this should be fixed when we update Piwik's version of ZF -- and we already have a ticket open for this task.
Proposal: don't add/append/prepend the existing include path to the new include path. AFAIK, Piwik ships with no external ZF/PEAR/Smarty dependency.
(Sorry, I had re-read freyp's comment and then it sunk in.)
(In ) Fixes #783 - don't append preset include path; thanks feyp.