Php Geek
Php Geek

Reputation: 1107

phpQuery not working

Hi friends i have downloaded the phpQuery plugin from their site . But whenever i try to run the phpQuery demo.php file i get the following error :-

Error:-

Fatal error: Uncaught exception 'Exception' with message
    "Old PHP4 DOM XML extension   detected. phpQuery won't work until this extension is enabled."
in   C:\wamp\www\phpQuery\phpQuery\phpQuery.php:483
Stack trace:
    #0 C:\wamp\www\phpQuery\phpQuery\phpQuery.php(271): phpQuery::createDocumentWrapper('<div/>',  NULL)
    #1 C:\wamp\www\phpQuery\demo.php(11): phpQuery::newDocument('<div/>')
    #2 {main} thrown in C:\wamp\www\phpQuery\phpQuery\phpQuery.php on line 483

My php version is 5.2.9-1. What extra extension i need ? Can anyone help me out with this error ??

Upvotes: 0

Views: 1453

Answers (3)

zneak
zneak

Reputation: 138171

This error message is misleading. If you look up phpQuery's source, you'll see that it should indeed say the opposite: "phpQuery won't work until this extension is disabled". (Or at least, that's what the source code would lead me to believe, since functions stop to exist when you disable extensions, not when you enable them.)

The reference for this extension on the PHP website is no longer available, but archive.org still has a copy of it. This page tells us that the PHP4 DOM extension's DLL name is php_domxml.dll, so this is what you need to remove.

In your php.ini file, you need to comment the line where it says extension=php_domxml.dll. You can make it a comment by prefixing the line with a semicolon.

This all assumes you're not mistaken about your PHP version. I suggest you check a <?php phpinfo(); ?> to verify that you run the PHP version you're expecting, if you haven't already done so. I find it surprising that a PHP5 install would still use a PHP4 extension.

Upvotes: 3

Lightness Races in Orbit
Lightness Races in Orbit

Reputation: 385264

phpQuery is trying to detect whether you have the PHP 4 the DOM XML extension on your system, or the PHP 5 DOM extension that superceded it.

Unfortunately, it's lying to you about the outcome. You can see the relevant phpQuery code here:

if (function_exists('domxml_open_mem'))
    throw new Exception("Old PHP4 DOM XML extension detected. phpQuery won't work until this extension is enabled.");

It meant "disabled", not "enabled". You have to disable the "DOM XML" extension in your configuration.

This problem is filed as phpQuery issue #224.

Upvotes: 2

LuckySpoon
LuckySpoon

Reputation: 588

I would suggest that you read the error message. You have an old version of DOM XML.

You can obtain all the info you need regarding the new version at the official docs - but it is installed by default so I would suggest you update your WAMP to the latest version.

Upvotes: -2

Related Questions