Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

undefined function: domxml_open_mem()

Posted on 2004-11-02
19
Medium Priority
?
5,793 Views
Last Modified: 2011-08-18
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


0
Comment
Question by:stephaneeybert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 7
19 Comments
 
LVL 4

Expert Comment

by:aratani
ID: 12474999
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
 

Author Comment

by:stephaneeybert
ID: 12482365
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
 
LVL 4

Expert Comment

by:aratani
ID: 12484108
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:stephaneeybert
ID: 12484717
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
 
LVL 4

Expert Comment

by:aratani
ID: 12484923
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
 

Author Comment

by:stephaneeybert
ID: 12485367
I tried it, and got an error message.

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

The constructor requires an argument.

0
 
LVL 4

Expert Comment

by:aratani
ID: 12486216
<?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
 

Author Comment

by:stephaneeybert
ID: 12486477
So the load() member function is of no use in that case..?
0
 

Author Comment

by:stephaneeybert
ID: 12486502
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
 
LVL 4

Expert Comment

by:aratani
ID: 12486533
Dear Stephane,

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

AJ
0
 

Author Comment

by:stephaneeybert
ID: 12491347
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
 

Author Comment

by:stephaneeybert
ID: 12543102
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
 

Author Comment

by:stephaneeybert
ID: 12543121
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
 

Author Comment

by:stephaneeybert
ID: 12552999
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
 
LVL 4

Expert Comment

by:aratani
ID: 12555916
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
 

Author Comment

by:stephaneeybert
ID: 12559933
All right. I'll check if I can see something in there..
0
 
LVL 4

Accepted Solution

by:
aratani earned 400 total points
ID: 12824397
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
 

Author Comment

by:stephaneeybert
ID: 12824541
Sorry Aratani! I had completely forgotten the question...

Thank you again for your support!

Kind Regards

Stephane
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question