A PHP install on Debian 5 by default does not include the Xslt extension which means the following error will occur if trying to use the XsltProcessor class: ” Fatal error: Class ‘XsltProcessor’ not found…”. This post shows how to install the extension on Debian 5.
The error message
If you run the following code:
$xslt = new XsltProcessor();
and get the following error message:
Fatal error: Class 'XsltProcessor' not found in /path/to/script.php on line XYZ
then then XSLT extension is not installed.
Install the XSLT extension on Debian
Run the following command, ether as root or using sudo:
apt-get install php5-xsl
You’ll see some stuff along the lines of this:
Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: php5-xsl 0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded. Need to get 12.8kB of archives. After this operation, 81.9kB of additional disk space will be used. Get:1 http://ftp.nz.debian.org lenny/main php5-xsl 5.2.6.dfsg.1-1+lenny3 [12.8kB] Fetched 12.8kB in 0s (47.4kB/s) Selecting previously deselected package php5-xsl. (Reading database ... 48949 files and directories currently installed.) Unpacking php5-xsl (from .../php5-xsl_5.2.6.dfsg.1-1+lenny3_i386.deb) ... Setting up php5-xsl (5.2.6.dfsg.1-1+lenny3) ...
At which point it is installed. Apache still needs to be reloaded in order to get access to the extension’s functions, and this can be done with a graceful restart like so, again running the command either as root or using sudo:
/usr/sbin/apache2ctl graceful