title: simplexml_load_file(): I/O warning : failed to load external entity &quot;/user-bundle/Resources/config/doctrine/model/User.orm.xml
body: <p>I have some issue with my production deployment of Symfony2,</p>
  
  <p>I've tried many solutions, but none have worked.</p>
  
  <p>I randomly have this error when accessing my symfony application on production environment:</p>
  
  <pre><code>( ! )   Fatal error: Uncaught exception 'Symfony\Component\Debug\Exception\ContextErrorException' with message 'Warning: simplexml_load_file(): I/O warning : failed to load external entity    &amp;quot;/home/user/symfony/vendor/friendsofsymfony/user-bundle/Resources/config/doctrine/model/User.orm.xml&amp;quot;'    in /home/user/symfony/app/bootstrap.php.cache on line 2998
  ( ! )   Symfony\Component\Debug\Exception\ContextErrorException: Warning: simplexml_load_file():    I/O warning : failed to load external entity    &amp;quot;/home/user/symfony/vendor/friendsofsymfony/user-bundle/Resources/config/doctrine/model/User.orm.xml&amp;quot; in /home/user/symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php on line 736
  Call Stack
  #   Time    Memory  Function    Location
  1   0.0000  262880  {main}( )   ../app_dev.php:0
  2   0.0015  572736  Symfony\Component\HttpKernel\Kernel-&gt;handle( )  ../app_dev.php:79
  3   0.1342  4023952 Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel-&gt;handle( )    ../bootstrap.php.cache:2376
  ( ! )   LogicException: Request stack is empty  in /home/user/symfony/app/bootstrap.php.cache on line 2998
  Call Stack
  #   Time    Memory  Function    Location
  1   0.3330  7110120 Symfony\Component\Debug\ErrorHandler-&gt;handleException( )    ../classes.php:0
  2   0.3331  7119696 Symfony\Component\Debug\ErrorHandler-&gt;handleException( )    ../classes.php:1939
  </code></pre>
  
  <p>I've tried to upgrade my php version (I was in php 5.4.x and now in 5.6.4),</p>
  
  <p>I've tried to upgrade lixml2 version (i am in 2.8.0 now, but i already tried to upgrade in 2.9.3)</p>
  
  <p>I've constated that the version of libxml used in php is always 2.8.0, but, I haven't found the way to change this ,</p>
  
  <p>I've tried to set the all directory of symfony in chmod 777</p>
  
  <p>My server is a debian 7.5 server.</p>
  
  <p>Maybe someone who knows this error can help me</p>
  
  <p>Here is some links to differents question related to this one:</p>
  
  <p><a href="https://stackoverflow.com/questions/27035821/random-error-symfonycontexterrorexception-warning-simplexml-load-file-i-o">Random Error</a>, <a href="https://github.com/FriendsOfSymfony/FOSUserBundle/issues/1062" rel="noreferrer">FOSUserBundle Error</a> and <a href="https://github.com/symfony/symfony/issues/7291" rel="noreferrer">Service error</a></p>
  
  <p>I didn't post in them because they're all outdated</p>
  
  <p>[EDIT]</p>
  
  <p>I found a quick fix, but it's in vendors, so it will be overrided in the first update of the doctrine update:</p>
  
  <p>QuickFix in XmlDriver.php Line 737</p>
  
  <pre><code>$xmlElement = @simplexml_load_file($file);
  if(!$xmlElement){
          $xmlData = file_get_contents($file);
          $xmlElement = simplexml_load_string($xmlData);
  }
  </code></pre>