Search code examples
phpzend-frameworkubuntuzend-config-xml

Zend simplexml_load_file() path not working in Apache in Ubuntu


I am trying to load an xml file from a helper method inside scripts folder with

$styleData = new Zend_Config_Xml($this->view->baseUrl().'/styles/style1/style.xml');

And i am getting error Uncaught exception 'Zend_Config_Exception' with message 'simplexml_load_file(): I/O warning : failed to load external entity "/my_blog/public/styles/style1/style.xml"' in /usr/share/php/libzend-framework-php/Zend/Config/Xml.php:98

Now if i do $styleData = new Zend_Config_Xml('localhost/'.$this->view->baseUrl().'/styles/style1/style.xml'); Then everything works fine Could you please help


Solution

  • can you try this

    $styleData = new Zend_Config_Xml($this->view->baseUrl("/styles/style1/style.xml"));
    

    I usually use it to add styles , javascript files another example

      $this->headLink()->appendStylesheet($this->baseUrl("css/reset.css"))
                    ->appendStylesheet($this->baseUrl("css/text.css"))
                    ->appendStylesheet($this->baseUrl("css/960.css"))
                    ->appendStylesheet($this->baseUrl("css/demo.css"));
            echo $this->headLink();
    

    hope that help you