I want to read data from XML file but it showing the following errors:
Exception information:
Message:simplexml_load_file(): I/O warning : failed to load external entity “/common/xml/demo.xml”
Following is my code:
public function init() {
require_once 'Zend/Config/Xml.php';
$xml = new Zend_Config_Xml('/common/xml/demo.xml');
echo $xml;
}
Any solutions…thanx
It looks like you’re trying to access /common/xml/demo.xml as an absolute path to a file. Do you have a /common directory in your root? Try getting rid of the first slash if what you mean is a relative path. If it’s supposed to be a URL, add the full domain and http://…
If you really have a file with absolute /common/xml/demo.xml, you have to make sure apache has proper access permissions to that file at both a system file permission level and a apache configuration level (assuming you’re not running this as a CLI script but serviing it as a site).