Complete error message:
Fatal error: require_once() [function.require]: Failed opening required 'HTMLPurifier/DefinitionCache.php' (include_path='./:/cust-web/*/*/********/sites/www.*******.**/include:/cust-web/*/*/*******/sites/include:/usr/share/php') in /cust-web/*/*/*******/sites/www.*******.**/html/sites/all/modules/htmlpurifier/HTMLPurifier_DefinitionCache_Drupal.php on line 3
* taken out account info
I'm busy migrating our websites to a new (shared) UNIX hosting provider. After uploading I was greeted with this error-message for both sites. The sites break and the only way to fix this seems to be to remove the HTML purifier module directory. This is kinda sucky as we plan to go live Tuesday.
Any thoughts on what is causing this and how to solve it?
My hunch is that it has to do with a php.ini setting that the HTML affects the HTML purifier module as the servers folder structure is:
/
-sites
-- includes
-- www.******.**
----html (drupal install dir)
----include
Comments
Comment #1
RedTop commentedHad a brainwave for a stop-gap measure:
I copied the HTML purifier library to one of the include directories as well. That seems to do the trick. However, ideally HTML purifier shouldn't be thrown off like this when a server has include_path configured... If you Google you will find lots of websites that apparently deal with similar issues...
Comment #2
ezyang commentedThis should not ever happen, since Drupal DefinitionCache is only ever loaded after require'ing HTMLPurifier.auto.php, which should modify the include_path appropriately. However, I don't see the appropriate include_path in your error message. Is there anything strange about your setup?
Comment #3
RedTop commentedI'm on shared linux hosting business plan (with a reputable ISP in Australia) so I don't know the ins and outs of the server config, although I do have a feeling that the setup is somewhat exotic. For example, I ran into permission/owner issues on the files folder, this particular issue and some strange behaviour of the FTP server in that it doesn't show hidden files (such as .htaccess) in the FTP client by default.
The server is hardened using suhosin.
Comment #4
ezyang commentedOk. Can you place a line var_dump(get_include_path()); in HTMLPurifier.auto.php before and after the autoload include? What does it output?
Comment #5
Anonymous (not verified) commentedHello,
we are recommended to put the library in sites/all/libraries, but this line is still in modules/htmlpurifier/HTMLPurifier_DefinitionCache_Drupal.php:
and this also fails in HTMLPurifier.auto.php:
Whatever that's trying to do, doesnt do it. It doesnt change the path on my client's hosting.
Comment #6
ezyang commentedHello,
Are you by any chance setting the include path via a .htaccess file?
Comment #7
RedTop commentedSorry for not getting back to you ezyang. It's just that I need to find a proper time to do this as it only affects our production environment (dev is hosted somewhere else...). That obviously means putting the site in maintenance mode so I will have to do some planning and try and do updates at the same to minimise the time the amount of time(s) the site if offline..
I'll get back to you soon.
Comment #8
RedTop commentedToday we updated our production environment so I got a chance to test what you suggested. Adding those lines didn't make a difference (no output whatsoever) so it seems as if HTMLPurifier.auto.php is being ignored...
I have not set the include path using the .htaccess file.
I've send you a PM with additional info.
Comment #9
ezyang commentedAh, the fact that auto.php is not being loaded all is interesting. Do you have warnings/notices enabled for your site? Can you get a trace from code executing in HTMLPurifier_DefinitionCache_Drupal.php? What happens if you add an include for HTMLPurifier.auto.php at the top of HTMLPurifier_DefinitionCache_Drupal.php?
Comment #10
ezyang commentedComment #11
Helmut Neubauer commentedI've the same problem. If I change the php include path from .: to .:/usr/share/php HTML Purifier causes blank sites due to include fails.
My HTML Purifier is located in libraries (not module).
Adding var_dump(get_include_path()); in HTMLPurifier.auto.php (#4) returns the HTML purifier library path if I don't change the php include path (.:) and nothing if I change the php include path.
If I add an include for HTMLPurifier.auto.php at the top of HTMLPurifier_DefinitionCache_Drupal.php (#9), I'll get the warning:
warning: require_once(HTMLPurifier.autoload.php): failed to open stream: No such file or directory in /var/www/vhosts/mydomain/httpdocs/sites/all/modules/htmlpurifier/HTMLPurifier_DefinitionCache_Drupal.php on line 3.
Comment #12
Helmut Neubauer commentedComment #13
Helmut Neubauer commentedNormally there is no problem with HTML purifier if PHP include_path is empty (".:"). But If you need to extend this PHP include_path (for example ".:/usr/share/php/" to include PHP classes installed by PEAR), HTML purifier causes blank sites because
require_once 'HTMLPurifier/DefinitionCache.php';of HTMLPurifier_DefinitionCache_Drupal.php fails.It seems setting the include path of HTML purifier library (HTMLPurifier.auto.php) isn't called anymore. I don't know why. Has anyone an idea? I'm not sure if there are problems with other modules interfering. Is there anyone having this problem, too?
As workaround you don't need to copy the whole library. Simply add the library folder of HTMLPurifier also to the PHP include_path. I did it by adapting my vhost.conf:
php_admin_value include_path ".:/var/www/vhosts/mydomain/httpdocs/sites/all/libraries/htmlpurifier/library:/usr/share/php"
Comment #14
heddn@Helmut Neubauer
In HTMLPurifier.auto.php from the HTML Purifier library, is your path set to:
.:/usr/share/php:/usr/share/pearprior to line 6? When set to that, things still work for me.
What is shown by get_include_path() on line 292 of htmlpurifier.module, right before you call?
require_once "$library_path/library/HTMLPurifier.auto.php";For me it is showing:
.:/usr/share/php:/usr/share/pearAnd also, what is shown by get_include_path() on line 3 of HTMLPurifier_DefinitionCache_Drupal.php, right before you call?
require_once 'HTMLPurifier/DefinitionCache.php';For me it is showing:
~/websites/drupal-6/sites/all/libraries/htmlpurifier/library:.:/usr/share/php:/usr/share/pearComment #15
francis004 commentedhi, please i'm having issues with my site after uploading it from my local machine to a host.it gives me that error message when i go to the site's url and i totally don't have an idea on how to go about it because i'm new to this. Can somebody please give me step by step instructions on how to go about it because i'm lost right now and have a deadline to meet thanks.