Page 1 of 1

Call to undefined function simplexml_load_file()

Posted: Thu May 05, 2011 10:53 am
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!

Re: Call to undefined function simplexml_load_file()

Posted: Thu May 05, 2011 10:54 am
by sunegtheoverlord
Additional info:-

I can't see anything on phpinfo() that says anything about simplexml so i'm assuming its not loaded.

Re: Call to undefined function simplexml_load_file()

Posted: Thu May 05, 2011 11:38 am
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

Re: Call to undefined function simplexml_load_file()

Posted: Fri May 06, 2011 2:40 pm
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.

Re: Call to undefined function simplexml_load_file()

Posted: Fri May 06, 2011 3:44 pm
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.