import html can't find php xsl support

mrtuttle - May 28, 2007 - 20:06
Project:Import HTML
Version:5.x-1.2
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Import HTML -> Demo complains "No XSL library support at all on this server!" even though phpinfo() reports xml and xsl support is enabled. Details below. As will become clear, I'm just getting started, and know next to nothing about drupal or php. Can anyone point me in the right direction? Extensive googling has been no help this time. Thanks. -Mark

I'm running

Drupal 5.1 installed on Windows XP running Apache 2.0.55
PHP 5.2.2
Import HTML version 5.x-1.2

When I go to Inport HTML -> Demo and enter a URL like http://www.gbtc.org/index.html and click Next I get the error messages

  • user error: No XSL library support at all on this server! in C:\Program Files\Apache Group\Apache2\htdocs\drupal\sites\all\modules\import_html\coders_php_library\xml-transform.inc on line 32.
  • user error: Sorry, with no XML support there will be no content scanning AT ALL. Aborting process. See the import_html_help.htm for info on enabling XML under PHP. in C:\Program Files\Apache Group\Apache2\htdocs\drupal\sites\all\modules\import_html\import_html.module on line 1676.
  • Failed to process file '/index.html'

When I go to line 32 in xml-transform.inc and clip the complaining function init_xsl, paste it into the following test file test.php, and run "php test.php" from the DOS command line, I get a "1" printed just as you would expect.

<?php

function init_xsl() {
 
// Just loading this lib means we really want to have XML
  // OK, support both old & new PHP library ways of doing things ...
 
if (!extension_loaded('xsl') && !extension_loaded('xslt')) {
   
debug("Need to try and dynamically load XSL extension. Please do this properly on the server to avoid this message.");
    if (!@
dl('xslt.so')&&!@dl('php_xslt.dll')&&!@dl('php_xsl.dll')) {
     
trigger_error("No XSL library support at all on this server!" , E_USER_ERROR );
      return
FALSE;
    }
   
debug("Ready to use XSL on the server",2);
  }
  return
TRUE;
}

print
init_xsl() . "\n";
?>

This suggests to me that php support for xsl is enabled, contrary to the Import HTML error message. In fact, the phpinfo() report includes the following entries:

libxml

libXML support => active
libXML Version => 2.6.26
libXML streams => enabled

xml

XML Support => active
XML Namespace Support => active
libxml2 Version => 2.6.26

xmlreader

XMLReader => enabled

xmlwriter

XMLWriter => enabled

xsl

XSL => enabled
libxslt Version => 1.1.17
libxslt compiled against libxml Version => 2.6.26
EXSLT => enabled
libexslt Version => 0.8.13

It is as if drupal and the command line are using different installations of php, but c:\php\php.exe is the only file on the computer with the name php.exe.

#1

dman - May 29, 2007 - 03:20

Wow. Now THAT is how to write an error report :) Great!

OK. My suspicion is that php from the command line is not using the same php.ini as the webserver does. It happens.
If you are using XAMMP, the actual php.ini is in the apache directory, and the one in the php directory is a red herring. In other windows-apache distros the php.ini may land in /windows dir.

Try phpinfo() in a web page and see if it's different. That'll tell you the real php.ini path as well.

Sounds like you enabled it right .. but in the wrong place. Yes, it would be nice if that was documented somewhere in the install (maybe it is) but I remember going through that process myself.

Try that.

#2

mrtuttle - June 2, 2007 - 02:57

Thanks for the tip.

  • It turns out that copying c:\php\php.ini to c:\windows didn't solve the problem. I created the file test.php
    <?php phpinfo() ?>
    and ran it from the command line and from the browser, and in both cases I got the same result:
    Configuration File (php.ini) Path => C:\WINDOWS
    Loaded Configuration File => C:\php\php.ini
    But your tip together with two days of googling led me to the page http://drupal.org/node/146679 which points out that the PHP5 MSI installer adds c:\php\ to PATH but not c:\php\ext\, so Windows can't find php_xsl.dll and the other extension dlls in c:\php\ext\. Adding c:\php\ext\ to PATH solved the problem. I thought I might get the same effect by setting extension_dir to c:\php\ext in php.ini, but was surprised to see that php.ini was already doing this, so setting PATH seems like the right solution.
  • I had a subsequent problem resulting from the fact that the path "c:\program files\apache group\apache2" to my apache installation contains spaces, which resulted in the error message
    Config: Can't open "C:/Program"
    Error: Can't open "Files/Apache"
    Error: Can't open "Group/Apache2/htdocs/drupal/sites/all/modules/import_html/coders_php_library/xhtml_tidy.conf"

    user warning: HTMLTidy failed to parse the input at all! It's probably very problematic HTML. A working version of tidy IS at c:/tidyhtml/tidy.exe isn't it? I ran c:/tidyhtml/tidy.exe -q -config C:/Program Files/Apache Group/Apache2/htdocs/drupal/sites/all/modules/import_html/coders_php_library/xhtml_tidy.conf "C:/WINDOWS/TEMP/htm2.tmp" and it returned: 2 in C:\Program Files\Apache Group\Apache2\htdocs\drupal\sites\all\modules\import_html\coders_php_library\tidy-functions.inc on line 156.
    Going to tidy-functions.inc and adding quotation marks \" to line 137 as follows
      define("TIDY_OPTIONS"," -q -config \"".foreslash( dirname(__FILE__)."/xhtml_tidy.conf\" ") );
    solved all my problems. Now I have only to learn xml/xsl, and I'll be all set! 8-)

I recommend adding the following comment to the end of section Guide -> Installation/setup -> XML Support in import_html_help.htm:

If you installed PHP5 under Windows XP using the MSI installer, then it is easy to get tidy and xsl support:

  • Use "Add/Remove Programs" to install the "Tidy" and "XSL" extensions. Go to Control Panel -> Add or Remove Programs -> PHP -> Change -> Next -> Change, expand the Expensions tab, and find "Tidy" and "XSL". Use the drop down menu next to each to select "Will be installed on local hard drive". Click "Next" and "Change". (You will still have to install the tidy.exe binary itself using the instructions in the next section.)
  • Make sure that your PATH environment variable contains both "c:\php\" and "c:\php\ext\" where "c:\php\" is the path to php.exe. Go to Contol Panel -> System -> Advanced -> Environment Variables, double click on PATH in the list under "System variables", and add "c:\php\;c:\php\ext\;" to the start of the value of PATH.

Thanks again.
Mark

#3

johnymap - August 13, 2008 - 14:43

Hi i am having the same problem.

The only difference with me is that i am running ubuntu 6.04, Apache2 , Drupal 5.x

Can anyone please help me. How should i configure tidyhtml in my case.

Thank you in advance.

#4

dman - August 13, 2008 - 22:36

trouble with tidy on ubuntu is different from trouble with XSL on Windows....

Have you tried
sudo apt-get install php5-tidy
?

#5

johnymap - August 14, 2008 - 08:24

Thanks dman

but this is the error that i get

sudo apt-get install php5-tidy
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package php5-tidy

#6

dman - August 14, 2008 - 09:05

Works for me.
You probably need to open up your repositories a bit. See the ubuntu howtos, and try enabling the universe.

My current install is from
php5-tidy [5.2.3-1ubuntu6.4] (5.2.3-1ubuntu6.4 Ubuntu:7.10/gutsy-updates)

 
 

Drupal is a registered trademark of Dries Buytaert.