Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Test Whether SimpleXML is installed on my PHP or not?

Tags:

php

mysql

vb.net

Anyone knows that? That thing is installed by default. But is there an easy way to check whether an extension is installed or not?

I check that simplexml_load_string is available to me but how do simplexml is not listed on php.ini

like image 373
Anonymous White Avatar asked Jul 21 '11 10:07

Anonymous White


People also ask

What is simple XML extension in PHP?

SimpleXML is an extension that allows us to easily manipulate and get XML data. SimpleXML provides an easy way of getting an element's name, attributes and textual content if you know the XML document's structure or layout.

How do I create a SimpleXML object?

Example #2 Create a SimpleXMLElement object from a URL$sxe = new SimpleXMLElement('http://example.org/document.xml', NULL, TRUE); echo $sxe->asXML();


2 Answers

There is another way also. You can create a php page

    <?php
     echo phpinfo();
    ?>

You can see Simple XML enabled or disabled here.

like image 142
Srinath Avatar answered Sep 30 '22 16:09

Srinath


This works for me...

extension_loaded('simplexml')

example:

if (extension_loaded('simplexml')) {

    echo "all good, extension is installed";

} else{ echo "snip snap! no cigar";}    
like image 41
Beard of Binary Avatar answered Sep 30 '22 18:09

Beard of Binary