tags:

views:

367

answers:

5

I'm trying to install this PHP module from NYTimes (http://code.nytimes.com/projects/xslcache)

I unfortunately am falling at the last hurdle. I've installed it, added to my php.ini, but I am getting this error when running in my PHP code.

Fatal error: Class 'xsltCache' not found in...

My php code is as described by the NYTimes website

$xslt = new xsltCache;

Any ideas why that may happen?

My install script for the module is

cd ~
mkdir setups
cd setups
wget http://code.nytimes.com/downloads/xslcache.tar.gz
tar -xvf xslcache.tar.gz
cd xslcache
phpize && ./configure --with-xslcache=/usr/lib/libxslt.so --with-xsl-exsl-dir=/usr/lib/libexslt.so
make
make install

And it seems to work completely fine, no errors, php.ini is fine. Something I have notified, it doesn't show up in phpinfo().

A: 

It sounds like you haven't loaded the extension in you php.ini file with extension=xslcache.so. If you do have that line in your php.ini file, check your error logs and see if PHP had trouble loading the extension.

Edward Z. Yang
I did add it to the php.ini file, where would I locate the error logs relating to this?
James
Assuming Linux, and that you're running the script from Apache, check your apache error.log. If you have shell access, try running php directly.
Edward Z. Yang
A: 

Throwing out a guess here but capitalisation issue? The API docs refer to the class as XSLTCache() but the cover page on nytimes and your code say xsltCache(); I can't tell from what I've read or what i can find on Google whether PHP classnames are case-sensitive.

SpliFF
A: 

it is a capitalization issue, but not quite what SpliFF suggests:

If you look at this test include file on the nytimes site, the capitalization should be:

$proc = new xsltcache;
John Weldon
Yet if you look in php_xsl.c, it declares the class as "XSLTCache".
Ben Blank
yes, but we're not talking about the name for it in code, we're talking about how to include it. The link I posted is the publishers own example of how to include it. James needs to change xsltCache to xsltcache. :)
John Weldon
I would have to say that that is not the problem, php is mostly case insensitive.
SeanJA
A: 

Could it be a permission problem on the /usr/lib/libexslt.so file? Maybe php does not have access to it?

SeanJA
+2  A: 

Check that you added the extension to the correct php.ini file.

If you have a PHP directory you may have one in there, but the one you want to add the extension to is likely in your server directory.

I.E. On my PC, the correct php.ini to modify is apache\bin\php.ini

P.S. Don't forget to restart your server.

Joe Bubna