Page 1 of 1

php DOM

Posted: Tue May 18, 2004 1:21 am
by bm1
hi im trying to get the DOM working in my scripts but i get an error which says doesnt recognise function or something like that. ive done a little reading and found that php needs to be configured with dom support. i use slackware 9.1 and im not sure if dom support is or is not configured. any ideas are much appreciated.

Posted: Tue May 18, 2004 3:03 am
by patrikG
You'll need to install PHP with "--with-dom" and have the libxml tarball (I think latest version is 2.6 something).

For more info:
PHP Manual wrote:XXIV. DOM XML Functions
Introduction

Warning

This extension is EXPERIMENTAL. The behaviour of this extension -- including the names of its functions and anything else documented about this extension -- may change without notice in a future release of PHP. Use this extension at your own risk.

The DOM XML extension has been overhauled in PHP 4.3.0 to better comply with the DOM standard. The extension still contains many old functions, but they should no longer be used. In particular, functions that are not object-oriented should be avoided.

The extension allows you to operate on an XML document with the DOM API. It also provides a function domxml_xmltree() to turn the complete XML document into a tree of PHP objects. Currently, this tree should be considered read-only - you can modify it, but this would not make any sense since DomDocument_dump_mem() cannot be applied to it. Therefore, if you want to read an XML file and write a modified version, use DomDocument_create_element(), DomDocument_create_text_node(), set_attribute(), etc. and finally the DomDocument_dump_mem() function.
Requirements

This extension makes use of the GNOME XML library. Download and install this library. You will need at least libxml-2.4.14. To use DOM XSLT features you can use the libxslt library and EXSLT enhancements from http://www.exslt.org/. Download and install these libraries if you plan to use (enhanced) XSLT features. You will need at least libxslt-1.0.18.
Installation

This extension is only available if PHP was configured with --with-dom[=DIR]. Add --with-dom-xslt[=DIR] to include DOM XSLT support. DIR is the libxslt install directory. Add --with-dom-exslt[=DIR] to include DOM EXSLT support, where DIR is the libexslt install directory.

Note to Win32 Users: In order to enable this module on a Windows environment, you must copy one additional file from the DLL folder of the PHP/Win32 binary package to the SYSTEM32 folder of your Windows machine (Ex: C:\WINNT\SYSTEM32 or C:\WINDOWS\SYSTEM32). For PHP <= 4.2.0 copy libxml2.dll, for PHP >= 4.3.0 copy iconv.dll from the DLL folder to your SYSTEM32 folder.

Posted: Tue May 18, 2004 3:30 am
by bm1
i have
php-4.3.3-i486-2
libxml2-2.5.11-i486-2,
libxslt-1.0.33-i486-1


i need
libxml-2.4.14
libxslt-1.0.18

is there anything you can see that is wrong, what i think is that the default slackware php module is not configured with dom support. so how would i try to do this. can i just add it or do i have to configure the whole thing
thanks for your reply

Posted: Tue May 18, 2004 3:35 am
by patrikG
Could be that you need libxml2-devel - as suggested by this guy here.

I've never run Slackware - shouldn't be too different at all, though.

Posted: Tue May 18, 2004 3:40 am
by bm1
thats a little bit ahead but yeah, so i have to configure the whole php module. i saw on the net that there are a lot of options when you configure php and i dont understand most of them, but i dont want to mess anything else up cause its working all but the dom problem. yeah slackware rocks