Page 1 of 1

SimpleXMLElement not working in XAMPP 1.7.1

PostPosted: 06. April 2011 16:05
by paulmasri
When I call
Code: Select all
SimpleXMLElement("...an XML string...")
I get the error
Fatal error: Call to undefined function simplexmlelement()
Can you help?

I have XAMPP 1.7.1 installed (because I need PHP 5.2).
NB: I've checked to see that libxml is installed. When I run
Code: Select all
print_r(get_loaded_extensions());
it lists libxml and SimpleXML.

Any ideas? :?:

Re: SimpleXMLElement not working in XAMPP 1.7.1

PostPosted: 06. April 2011 17:23
by WilliL
found for you with goole search 8)
"Fatal error: Call to undefined function simplexmlelement()"

http://www.webdeveloper.com/forum/showthread.php?t=191658

Re: SimpleXMLElement not working in XAMPP 1.7.1

PostPosted: 07. April 2011 11:21
by paulmasri
WilliL wrote:found for you with goole search 8)
"Fatal error: Call to undefined function simplexmlelement()"

http://www.webdeveloper.com/forum/showthread.php?t=191658


Unfortunately there isn't an simplexml extension to uncomment in the XAMPP php.ini.
For what it's worth, I put "extension=simplexml.dll" anyway (changing the .so from the above URL to a .dll as we're on Windows). Apache restarted OK (to my surprise) but it didn't solve the problem. Looking through the xampp\php\ext folder shows that simplexml.dll isn't there.

NB: I did a fair bit of Google searching before posting here... not to say I didn't miss something tho!

Anyone else got ideas about getting SimpleXMLElement() working in XAMPP 1.7.1?

Re: SimpleXMLElement not working in XAMPP 1.7.1

PostPosted: 20. April 2011 14:15
by paulmasri
After a bit more checking, I see that SimpleXML is enabled, by looking at phpinfo(). Any ideas why it still says "undefined function simplexmlelement()"?

Re: SimpleXMLElement not working in XAMPP 1.7.1

PostPosted: 11. May 2013 19:24
by drull
Because SimpleXMLElement is not a function, it's a class.
Use it like this:
$xml = new SimpleXMLElement(....)