How to read and update configuration file in zend framework

when I tried to update the configuration file, an exception would be thrown
"Failed to write to file" /opt/lampp/htdocs/fashion/application/configs/d.xml "

$xml=ROOT_PATH.'/application/configs/d.xml';
$config=new Zend_Config_Xml($xml,null,true);
$conf_arr=$config->toArray();
$conf_arr['name']='somebody';
$conf_writer=new Zend_Config_Writer_Xml();
try 
{
  $conf_writer->write($xml,new Zend_Config($conf_arr),false);
} catch (Exception $e) 
{
  echo '<h1 style="color:red;">'.$e->getMessage().'</h1>';
}

xml file

<?xml version="1.0" encoding="UTF-8"?>
<data>
    <name>ahmed</name>
    <living>Saudi Arabia</living>
</data>

when I save it in another file, it works, but it seems that it is locked, how to unlock

+3
source share
1 answer

I think your "d.xml" is not writable by Apache !?

Your "configs" directory is definitely writable (this is working with a new file), but not the default file.

+2
source

All Articles