Solved

undefined function: domxml_open_mem()

Posted on 2004-11-02
5,734 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
Question by:stephaneeybert
    18 Comments
     
    LVL 4

    Expert Comment

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

    Author Comment

    by:stephaneeybert
    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
    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
    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
    <?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
    So the load() member function is of no use in that case..?
    0
     

    Author Comment

    by:stephaneeybert
    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
    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
    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
    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
    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
    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
    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
    All right. I'll check if I can see something in there..
    0
     
    LVL 4

    Accepted Solution

    by:
    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
    Sorry Aratani! I had completely forgotten the question...

    Thank you again for your support!

    Kind Regards

    Stephane
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    As this topic comes over and over again in different forms, I've finally decided to write a short (yea, right...) article / tutorial about pagination with PHP with MySQL database. There are dozens of these kind of tutorials, I know - I wanted to mak…
    The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
    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 look for a specific file type in a local or remote server directory using PHP.

    877 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now