Call to undefined function simplexml_load_file()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
sunegtheoverlord
Forum Commoner
Posts: 28
Joined: Thu Feb 18, 2010 5:02 am

Call to undefined function simplexml_load_file()

Post by sunegtheoverlord »

hi,

I'm trying to use simplexml to read an xml file and display the contents in a php web page.

My code however gives the error message in the subject.

I've scoured google and the answer you always seem to get is that it is loaded by default in PHP 5 and above.

i am running 5.2.8 but still get this error.

I can only assume that php-xml (? or something similar) has not been built properly in PHP.

PHP and Apache are running on a FreeBSD box.

i also have little to no experience in working on FreeBSD therefore any answers need to be in idiots guide format...

Help please!
User avatar
sunegtheoverlord
Forum Commoner
Posts: 28
Joined: Thu Feb 18, 2010 5:02 am

Re: Call to undefined function simplexml_load_file()

Post by sunegtheoverlord »

Additional info:-

I can't see anything on phpinfo() that says anything about simplexml so i'm assuming its not loaded.
incubi
Forum Contributor
Posts: 119
Joined: Mon Dec 07, 2009 1:47 pm

Re: Call to undefined function simplexml_load_file()

Post by incubi »

Look in your php.ini/config file for this

extension=simplexml.so

Remove the ; if there is one.

If you don't have that line you may need to add it. Google the Module name for how to.

Lee
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Call to undefined function simplexml_load_file()

Post by requinix »

SimpleXML is built-in to PHP 5 by default and would have to be specifically disabled during compilation. It's not something you can simply enable - you have to rebuild PHP to get it.
It also requires libxml, so if you don't have that then you won't get SimpleXML.
incubi
Forum Contributor
Posts: 119
Joined: Mon Dec 07, 2009 1:47 pm

Re: Call to undefined function simplexml_load_file()

Post by incubi »

I understand that under FreeBSD the game changes a little and loading the module could be an option due to a bug when running on FreeBSD and the fact it does not compile correctly when installing. Its been a while so this may have been fixed.
Post Reply