undefined function: domxml_open_mem()

Dear all,

I get the following message, only when using my application on the web hotel server.

Fatal error: Call to undefined function: domxml_open_mem() in /home/httpd/vhosts/engine/system/template/design/model/TemplateModelUtils.php on line 325

The version and the phpinfo() of the web hotel server is:

PHP Version 4.3.8

'./configure' '--host=i386-redhat-linux' '--build=i386-redhat-linux' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--enable-mbstring=shared' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-apxs2=/usr/sbin/apxs'


On my own server, the version and the phpinfo() is:

PHP Version 4.3.7

'./configure' '--with-apxs2=/usr/local/apps/apache/bin/apxs' '--with-config-file-path=/usr/local/apps/php-4.3.7' '--enable-track-vars' '--enable-memory-limit' '--with-mysql' '--with-zlib' '--with-jpeg-dir=/usr/local/apps/jpeg-6b' '--with-png-dir=/usr/local/apps/libpng-1.2.5' '--with-gd' '--enable-ftp' '--enable-xslt' '--with-xslt-sablot' '--with-dom' '--enable-sockets' '--enable-wddx' '--with-xmlrpc'

And I get no such message...

Any idea..?

Kind Regards

Stephane


stephaneeybertAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arataniCommented:
The DOM extension hasn't be installed correctly.

You can go to the manual and read about installing it correctly,

http://us2.php.net/manual/en/ref.domxml.php

The important extension I believe you need is --with-dom

Make sure you also have all the libraries required installed, and given on the manual page and that I'm pasting here,

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 PECL extension is not bundled with PHP. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: http://pecl.php.net/package/domxml.

In PHP 4 this PECL extensions source can be found in the ext/ directory within the PHP source or at the PECL link above. 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.

Windows users will enable php_domxml.dll inside of php.ini in order to use these functions. In PHP 4 this DLL resides in the extensions/ directory within the PHP Windows binaries download. You may download this PECL extensions DLL from the PHP Downloads page or at http://snaps.php.net/. Also, there is one additional DLL that must be made available to your system's PATH in order for this extension to work. In PHP 4 this is in the dlls/ directory. It's name: For PHP <= 4.2.0, it's libxml2.dll. For PHP >= 4.3.0, it's iconv.dll. And as of PHP 5.0.0, iconv is compiled into your Windows PHP binaries by default so no extra DLL is needed.

Abhishek (AJ) Ratani
0
stephaneeybertAuthor Commented:
Is there an alternative php function that I could use?

I'm a bit cold feet about compiling php on my dedicated server...

Thanks!

Stephane
0
arataniCommented:
http://us2.php.net/manual/en/ref.dom.php

Try this, and look at the example at the bottom of the page. I believe this should work.

AJ
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

stephaneeybertAuthor Commented:
I see there are OO functions and non OO ones for the DOM XML.

I suppose I should use the OO Ones.

I could not find the documentation pages that describe the objects on the php.net web site...

Stephane
0
arataniCommented:
I would use the example that was posted at the bottom of the page (by a user of php), and that is how to use them.

AJ
0
stephaneeybertAuthor Commented:
I tried it, and got an error message.

I copy / pasted his code and it did not work.

The constructor requires an argument.

0
arataniCommented:
<?php
   $doc = new DomDocument($xml);
?>

$xml is the whole xml string. So, read the file into a variable called $xml and use it.

AJ
0
stephaneeybertAuthor Commented:
So the load() member function is of no use in that case..?
0
stephaneeybertAuthor Commented:
The get_attribute function does not work on your object.

I'm using a few xml functions here...

Here is my code:

    // Create the DOM document
    if (!$xmlDocument = domxml_open_mem($str, DOMXML_LOAD_PARSING + DOMXML_LOAD_COMPLETE_ATTRS + DOMXML_LOAD_SUBSTITUTE_ENTITIES + DOMXML_LOAD_DONT_KEEP_BLANKS)) {
      return;
      }

    // Get the root node
    $xmlRootNode = $xmlDocument->document_element();

    $templateModelNodes = $xmlRootNode->child_nodes();
    foreach ($templateModelNodes as $templateModelNode) {
      $name = $templateModelNode->get_attribute("name");
      $description = $templateModelNode->get_attribute("description");
      $modelType = $templateModelNode->get_attribute("modelType");
      }

    }


Kind Regards

Stephane
0
arataniCommented:
Dear Stephane,

I thought the original question was just about the php configuration and I believed I have answered that.

AJ
0
stephaneeybertAuthor Commented:
Dear Aratani,

As you can see my question was not specific to the configuration. Of course it is config related. But I was more looking for suggestions.

You also kindly suggested tha I use the --with-dom extension
"The important extension I believe you need is --with-dom"
but if you look at my phpconfig() I already use it.

And again I said early in this forum that I was not so keen on recompiling php.

But probably I have not been clear or explicit enough in my question.

My excuses for that!

Kind Regards
Stephane
0
stephaneeybertAuthor Commented:
I recompiled the php on my own local server.

Now the phpinfo() gives:

'./configure' '--with-apxs2=/usr/local/apps/apache/bin/apxs' '--with-config-file-path=/usr/local/apps/php-4.3.7' '--enable-track-vars' '--enable-memory-limit' '--with-mysql' '--with-zlib' '--with-jpeg-dir=/usr/local/apps/jpeg-6b' '--with-png-dir=/usr/local/apps/libpng-1.2.5' '--with-gd' '--enable-gd-native-ttf' '--with-freetype-dir=/usr/local/apps/freetype2' '--enable-ftp' '--with-xml' '--with-expat' '--with-dom' '--with-dom-xslt' '--with-dom-exslt' '--with-xmlrpc' '--enable-xslt' '--enable-exif' '--with-xslt-sablot' '--enable-sockets' '--enable-wddx'

The phpinfo() on the dedicated server still gives:

'./configure' '--host=i386-redhat-linux' '--build=i386-redhat-linux' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--enable-mbstring=shared' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-apxs2=/usr/sbin/apxs'
0
stephaneeybertAuthor Commented:
Here is the message I get on my local server:


Fatal error: Call to undefined function: load() in /home/stephane/dev/php/sites/linsite/engine/system/template/design/model/TemplateModelUtils.php on line 328

And the message I get on the dedicated server:

Fatal error: Cannot instantiate non-existent class: domdocument in /home/httpd/vhosts/engine/system/template/design/model/TemplateModelUtils.php on line 327
0
stephaneeybertAuthor Commented:
There is something I cannot explain regarding the php configuration.

The phpinfo() on my local server displays :

domxml
DOM/XML       enabled
DOM/XML API Version       20020815

and the options I used to configure php were:

'--with-xml' '--with-expat' '--with-dom' '--with-dom-xslt' '--with-dom-exslt' '--with-xmlrpc' '--enable-xslt' '--enable-exif' '--with-xslt-sablot' '--enable-sockets' '--enable-wddx'

The phpinfo() on a shared server displays also:

domxml
DOM/XML       enabled
DOM/XML API Version       20020815

and the options to configure php were:

'--with-dom=shared,/usr' '--with-dom-xslt=shared,/usr' '--with-dom-exslt=shared,/usr' '--enable-xslt=shared' '--with-xslt-sablot=shared,/usr'

But the phpinfo() on the dedicated server does NOT display the

domxml
DOM/XML       enabled
DOM/XML API Version       20020815

even if the options to configure php were:

'--with-xml' '--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' '--enable-sockets' '--enable-wddx'

Why the dedicated server does not enable the DOM XML..?


0
arataniCommented:
I haven't configured DOM XML too much, but I know that with PHP all the options depends on all the directoies that you give. So, there might be something wrong with the directories where the DOM XML files are located.

AJ
0
stephaneeybertAuthor Commented:
All right. I'll check if I can see something in there..
0
arataniCommented:
The question was about "Fatal error: Call to undefined function: domxml_open_mem() in /home/httpd/vhosts/engine/system/template/design/model/TemplateModelUtils.php on line 325".

And I believe I answered and helped stepaneeybert out with solving the problem.

Thanks

AJ
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stephaneeybertAuthor Commented:
Sorry Aratani! I had completely forgotten the question...

Thank you again for your support!

Kind Regards

Stephane
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.