Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: Php5 Xml Dom

  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts

    Php5 Xml Dom

    Yo all,

    I could not decide if this goes here or XML forum, as it may be a php config issue. Please move if you think its wrong place.

    Anyways I have the below, creates a new dom document and loads in some xml ...

    PHP Code:
    <?
    print "this gets displayed";
    $dom = new DomDocument();
    $dom->load("http://localhost/file.xml");
    print 
    "this does not get displayed";
    ?>
    The file is in the specified location.

    This does not work. Funny thing is no error, just kills the script. Anything before the new DomDocument(); gets processed but anything after it does.. as it the code breaks the script.. but no actual errors or php warnings.

    It is Suse 10.1 and PHP 5.1.2. The 'dom' works on there for javascript. Is it the same one it uses or different? or did i miss understand?

    If anyone can tell me where to look to resolve this it be much apperciated.

    Warm Regards,
    Sir P

  • #2
    Regular Coder ralph l mayo's Avatar
    Join Date
    Nov 2005
    Posts
    951
    Thanks
    1
    Thanked 31 Times in 29 Posts
    Snippet works fine for me with some XML file I had laying around, can you post the actual document you're working with?

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by ralph l mayo View Post
    Snippet works fine for me with some XML file I had laying around, can you post the actual document you're working with?

    Thats the entire document Ralph

    Just hangs on the new DomDocument part... which is why I wonder if dom or php config somewhere?


    any ideas?

    and yup i can get that code to work on another platform.

    cheers

  • #4
    Regular Coder ralph l mayo's Avatar
    Join Date
    Nov 2005
    Posts
    951
    Thanks
    1
    Thanked 31 Times in 29 Posts
    I mean file.xml...

    Other ideas: make sure your error reporting is on and set at a low threshold. See if something ends up in apache's logs.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    Morning Ralph.

    The xml file works using that code on another platform, so the file is fine. Also I removed the load file bit so I only have the new DomDocument line and it still does the same.

    Ah ha... Looking in apache error_log...
    [Wed Feb 28 09:18:07 2007] [error] [client 127.0.0.1] PHP Fatal error: Class 'DomDocument' not found in /srv/www/htdocs/xml.php on line 4
    So, that class is not there. But I thought it was part of PHP 5 core? libxml 2.62.1 is showing in phpinfo() as active and enabled.
    I'm going to browse the php.net site but if you have any ideas, please let me know.

    many thanks

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    d'oh is everyone as stumped as me ?

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    I have found the problem and resolved it!

    For any of you that come across this issue.. although I had lib2xml installed, I did not have php5-dom installed.

    Cheers for the help all.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •