1

When i want to use xml libraries in php i get this error

Fatal error: Call to undefined function domxml_new_doc() in C:\AppServ\www\direction\db2xml.php on line 5

how can i solve it ?

Adham
  • 63,550
  • 98
  • 229
  • 344

4 Answers4

3

The domxml_new_doc() function is from the PHP4 DOM extension. It has been moved to the PECL repository and is no longer bundled with PHP as of PHP 5.0.0. PHP5 introduced a number of improved extensions to work with XML:

It will, however, never be released with PHP 5, and will only be distributed with PHP 4. If you need DOM XML support with PHP 5 you can use the DOM extension. This domxml extension is not compatible with the DOM extension.

See my answers to

Community
  • 1
  • 1
Gordon
  • 312,688
  • 75
  • 539
  • 559
1

If you are working with older code from PHP4 and wish to migrate the code to work on a php5 server with minimal effort, check out the following:

http://www.silicon-vision.com/wp/quickpost-php4-domxml-to-php5/

Simply drop in the include file and reference it at the start of the file that is failing, and it will simply just work like it used to. Not much else to it really. Used it on several older sites after migrating them to a new VPS earlier this year and was quite pleased at solving the issue without having to sit there and rewrite someones spaghetti code :)

Update 2015: I no longer maintain the old blog linked to above, however you can find the domxml tool here: https://alexandre.alapetite.fr/doc-alex/domxml-php4-php5/index.en.html

KevC
  • 31
  • 4
  • This webpage leads to Favicon. The link is misleading – Malcolm Salvador Jul 10 '15 at 08:49
  • I no longer maintain my old blog, thus the link is now dead. That said, you can easily find the info at : https://alexandre.alapetite.fr/doc-alex/domxml-php4-php5/index.en.html – KevC Jul 11 '15 at 18:12
0

Check that you have the module enabled and also that you have all required libraries.

webbi
  • 841
  • 7
  • 14
0

May be you have forget to uncomment or add

extension=php_domxml.dll

in your php.ini file?

MDI
  • 177
  • 10