NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
[resolved] Cannot instantiate non-existent class domxml


Joined: 24 Apr 2008
Posts: 5
Reply with quote
After reading this post:
php-extension-not-picked-up-in-debug-sessions-t320.html
and installing all .dlls, I'm still having this error:
Fatal error: Cannot instantiate non-existent class: domxml_new_doc in c:\...\file.php on line 26

Line 26 would be this one:
$dom = new domxml_new_doc('1.0');

I've also tryed running this:


<?php
header('Content-type: text/xml');
$x_doc = new domxml_new_doc('1.0');
$x_root = $x_doc->create_element('TEST');
$x_doc->append_child($x_root);
print $x_doc->dump_mem(false);
?>


With "new", I get the following error:
<b>Fatal error</b>: Cannot instantiate non-existent class: domxml_new_doc


<?php
header('Content-type: text/xml');
$x_doc = domxml_new_doc('1.0');
$x_root = $x_doc->create_element('TEST');
$x_doc->append_child($x_root);
print $x_doc->dump_mem(false);
?>


Without "new", the following:
<b>Fatal error</b>: Call to undefined function: domxml_new_doc()


Any ideas?
View user's profileFind all posts by yulashSend private message


Joined: 29 Feb 2008
Posts: 12
Reply with quote
This is only one reason of this fault, you haven't installed DOM XML Functions.
I guess you have server under Windows. In this case, check next.
1) If you use PHP4, check that you have php_domxml.dll in your extension folder, and you have this included in php.ini, i.e. you have to have line:
extension=php_domxml.dll
in your php.ini file (without semicolumn symbol at start of line, because it's comment symbol).
You can also create test script with next code:
Code:

<?
phpinfo()
?>

Then run it and check if DOM XML really installed.

2) If you use PHP5, it's another story... Because it's don't support DOM XML, and there isn't bundled .dll with PHP5, because it have class model for working with XML/HTML documents.
http://www.php.net/manual/ru/book.domxml.php
It's included in core of PHP5, as I remember.
View user's profileFind all posts by madfobosSend private message


Joined: 24 Apr 2008
Posts: 5
Reply with quote
Thank you so much for answering, and I'm sorry for the lack of information on previous post.

I'm running PHP Version 4.2.3 under Windows XP. I have libxml2.dll and php_domxml.dll both at extension and windows32 folders. I run phpinfo() test to check if I'm editing the correct php.ini file, and yes, I am. In it, I have:
extension=php_domxml.dll
And just added:
extension=libxml2.dll

And I still get this error:
Fatal error: Cannot instantiate non-existent class: domxml_new_doc


When I run phpinfo(), I see nothing related to DOM XML. Closer thing to it is:
xml
XML Support active
XML Namespace Support active
EXPAT Version 1.95.2


Any ideas on what am I doing wrong? Crying or Very sad


madfobos wrote:
This is only one reason of this fault, you haven't installed DOM XML Functions.
I guess you have server under Windows. In this case, check next.
1) If you use PHP4, check that you have php_domxml.dll in your extension folder, and you have this included in php.ini, i.e. you have to have line:
extension=php_domxml.dll
in your php.ini file (without semicolumn symbol at start of line, because it's comment symbol).
You can also create test script with next code:
Code:

<?
phpinfo()
?>

Then run it and check if DOM XML really installed.

2) If you use PHP5, it's another story... Because it's don't support DOM XML, and there isn't bundled .dll with PHP5, because it have class model for working with XML/HTML documents.
http://www.php.net/manual/ru/book.domxml.php
It's included in core of PHP5, as I remember.
View user's profileFind all posts by yulashSend private message


Joined: 24 Apr 2008
Posts: 5
Reply with quote
I've tried to upgrade to php5, but... Oh well, see bellow:



When running this:
<?
DOMDocument()
?>

I get this:

Fatal error: Call to undefined function domdocument()

Dunno what to do... Crying or Very sad
View user's profileFind all posts by yulashSend private message
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
Why do you call it like a function? DOMDocument is a class...

Code:
$oDOM = new DOMDocument ( '1.0', 'UTF-8' );
View user's profileFind all posts by BlizzSend private messageVisit poster's website


Joined: 24 Apr 2008
Posts: 5
Reply with quote
Blizz wrote:
Why do you call it like a function? DOMDocument is a class...

Code:
$oDOM = new DOMDocument ( '1.0', 'UTF-8' );


"First, check your configuration or try initializing a DOMDocument() to determine if your server's PHP has DOM functionality on. If you do have access to the DOM, you can use it to create XML nodes, append child nodes, and output an XML document. Since KML is an XML markup language, this works for KML as well. If DOM is not available on your server, try using either the dom_xml or echo method "

I wrote the script with using dom_xml, so I could run it in a PHP 4 server. I tried running $oDOM = new DOMDocument ( '1.0', 'UTF-8' ); as you explained, and there were no errors. I think what I'm gonna do is rewrite the whole script with PHP 5 DOM function, instead of dom_xml, and upgrade my server from PHP 4 to 5 and see if it works.

Thanks.
View user's profileFind all posts by yulashSend private message


Joined: 24 Apr 2008
Posts: 5
Reply with quote
Can't believe!!!!!!!!!! It's working!!!!!!!!!! Very Happy
Thanks guys! Wink

I couldn't run it with dom_xml @ PHP 4, but it worked using PHP 5 and DOM function... Don't ask me why, it just did. Rolling Eyes

I'm kinda happy right now Laughing Cool
View user's profileFind all posts by yulashSend private message
[resolved] Cannot instantiate non-existent class domxml
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic