Getting phpQuery running under XAMPP for Windows

While trying to run the initial test scripts included with phpQuery 0.9.4 RC1, I got the following warning:

Warning: domdocument::domdocument() expects at least 1 parameter, 0 given in C:\xampp\htdocs\phpQuery-0.9.4-rc1\phpQuery\phpQuery.php on line 280

This is strange because DOMDocument’s constructor has only optional arguments.

As it turns out, XAMPP for Windows ships PHP with the old PHP4 “domxml” extension enabled by default (appears as extension=php_domxml.dll in \xampp\apache\bin\php.ini). This deprecated extension has a somewhat less-documented OO API, with domxml_open_mem() being accessible via new DOMDocument(). I.e. domxml hijacks PHP5’s DOMDocument constructor.

Comment extension=php_domxml.dll out with a semicolon, restart Apache and phpQuery seems to work as designed.

One thought on “Getting phpQuery running under XAMPP for Windows

Leave a Reply