1

If I enable developer mode in magento 2 I get the following error:

Could not read config file
#0 /vendor/magento/framework/Config/Reader/Filesystem.php(113): Magento\Framework\Config\FileResolver->get('view.xml', 'global')
#1 /vendor/magento/framework/Config/View.php(210): Magento\Framework\Config\Reader\Filesystem->read()
#2 /vendor/magento/framework/Config/View.php(87): Magento\Framework\Config\View->initData()
#3 /vendor/magento/module-catalog/Helper/Image.php(833): Magento\Framework\Config\View->getVarValue('Magento_Catalog', 'product_image_w...')
#4 /vendor/magento/module-checkout/Block/Cart/Sidebar.php(75): Magento\Catalog\Helper\Image->getFrame()
#5 /var/generation/Magento/Checkout/Block/Cart/Sidebar/Interceptor.php(37): Magento\Checkout\Block\Cart\Sidebar->getImageHtmlTemplate()
#6 /vendor/magento/module-checkout/Block/Cart/Sidebar.php(65): Magento\Checkout\Block\Cart\Sidebar\Interceptor->getImageHtmlTemplate()
#7 [internal function]: Magento\Checkout\Block\Cart\Sidebar->getConfig()
#8 /vendor/magento/framework/Interception/Interceptor.php(144): call_user_func_array(Array, Array)
#9 /var/generation/Magento/Checkout/Block/Cart/Sidebar/Interceptor.php(26): Magento\Checkout\Block\Cart\Sidebar\Interceptor->___callPlugins('getConfig', Array, Array)
#10 /vendor/magento/module-checkout/view/frontend/templates/cart/minicart.phtml(45): Magento\Checkout\Block\Cart\Sidebar\Interceptor->getConfig()
#11 /vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/var/www/mount/...')
#12 /vendor/magento/framework/View/Element/Template.php(255): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Checkout\Block\Cart\Sidebar\Interceptor), '/var/www/mount/...', Array)
#13 /var/generation/Magento/Checkout/Block/Cart/Sidebar/Interceptor.php(297): Magento\Framework\View\Element\Template->fetchView('/var/www/mount/...')
#14 /vendor/magento/framework/View/Element/Template.php(279): Magento\Checkout\Block\Cart\Sidebar\Interceptor->fetchView('/var/www/mount/...')
#15 /vendor/magento/framework/View/Element/AbstractBlock.php(652): Magento\Framework\View\Element\Template->_toHtml()
#16 /var/generation/Magento/Checkout/Block/Cart/Sidebar/Interceptor.php(609): Magento\Framework\View\Element\AbstractBlock->toHtml()
#17 /vendor/magento/framework/View/Layout.php(542): Magento\Checkout\Block\Cart\Sidebar\Interceptor->toHtml()
#18 /vendor/magento/framework/View/Layout.php(518): Magento\Framework\View\Layout->_renderBlock('minicart')
#19 /var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('minicart')
#20 /vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('minicart')
#21 /var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('minicart', true)
#22 /vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('minicart')
#23 /vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('header-wrapper')
#24 /var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('header-wrapper')
#25 /vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('header-wrapper')
#26 /var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('header-wrapper', true)
#27 /vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('header-wrapper')
#28 /vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('header.containe...')
#29 /var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('header.containe...')
#30 /vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('header.containe...')
#31 /var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('header.containe...', true)
#32 /vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('header.containe...')
#33 /vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('page.wrapper')
#34 /var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper')
#35 /vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper')
#36 /var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.wrapper', true)
#37 /vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('page.wrapper')
#38 /vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('root')
#39 /var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('root')
#40 /vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root')
#41 /var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('root', true)
#42 /vendor/magento/framework/View/Layout.php(938): Magento\Framework\View\Layout\Interceptor->renderElement('root')
#43 [internal function]: Magento\Framework\View\Layout->getOutput()
#44 /vendor/magento/framework/Interception/Interceptor.php(144): call_user_func_array(Array, Array)
#45 /var/generation/Magento/Framework/View/Layout/Interceptor.php(494): Magento\Framework\View\Layout\Interceptor->___callPlugins('getOutput', Array, Array)
#46 /vendor/magento/framework/View/Result/Page.php(241): Magento\Framework\View\Layout\Interceptor->getOutput()
#47 /vendor/magento/framework/View/Result/Layout.php(162): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))
#48 [internal function]: Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#49 /vendor/magento/framework/Interception/Interceptor.php(74): call_user_func_array(Array, Array)
#50 /vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\View\Result\Page\Interceptor->___callParent('renderResult', Array)
#51 /vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Framewo...', 'renderResult', Object(Magento\Framework\View\Result\Page\Interceptor), Array, 'result-varnish-...')
#52 /vendor/magento/module-page-cache/Model/Controller/Result/VarnishPlugin.php(74): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
#53 [internal function]: Magento\PageCache\Model\Controller\Result\VarnishPlugin->aroundRenderResult(Object(Magento\Framework\View\Result\Page\Interceptor), Object(Closure), Object(Magento\Framework\App\Response\Http\Interceptor))
#54 /vendor/magento/framework/Interception/Chain/Chain.php(68): call_user_func_array(Array, Array)
#55 /vendor/magento/framework/Interception/Interceptor.php(136): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Framewo...', 'renderResult', Object(Magento\Framework\View\Result\Page\Interceptor), Array, 'result-builtin-...')
#56 /vendor/magento/module-page-cache/Model/Controller/Result/BuiltinPlugin.php(67): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
#57 [internal function]: Magento\PageCache\Model\Controller\Result\BuiltinPlugin->aroundRenderResult(Object(Magento\Framework\View\Result\Page\Interceptor), Object(Closure), Object(Magento\Framework\App\Response\Http\Interceptor))
#58 /vendor/magento/framework/Interception/Interceptor.php(141): call_user_func_array(Array, Array)
#59 /var/generation/Magento/Framework/View/Result/Page/Interceptor.php(130): Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', Array, Array)
#60 /vendor/magento/framework/App/Http.php(119): Magento\Framework\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#61 /vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#62 /index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#63 {main}

Anyone an idea to solve that?

2 Answers 2

9

some of your xml files don't have read permissions.
The exception is thrown from here.
As you can see in the code, the file exists, because you end up inside if (file_exists($designPath)) {.
So you either you don't have read rights, or the file is not properly formatted.
You can add before the throw statement this echo $e->getMessage();exit; to see on the screen what's the exact error.

if (file_exists($designPath)) {
    try {
        $designDom = new \DOMDocument;
        $designDom->load($designPath);
        $iterator[$designPath] = $designDom->saveXML();
    } catch (\Exception $e) {
        throw new \Magento\Framework\Exception\LocalizedException(
            new \Magento\Framework\Phrase('Could not read config file')
        );
    }
}
3
  • 6
    The Problem was my custom theme which contains an empty view.xml file. Thanks for the hint! Commented Dec 15, 2015 at 15:02
  • 3
    in my case was the circled C of Copyright that was in a comment at the beginning of view.xml and that was not encoded properly... Thanks for the hint as well
    – Memes
    Commented Feb 3, 2016 at 7:41
  • 1
    @Memes, thank you for the tip, I had the same issue and after removing the copyright symbol, it worked.
    – nuwaus
    Commented Nov 6, 2017 at 11:09
0

The essence of the problem is that, in the Magento2 development model, the PHP system will validate the URL in the namespace of the XML file, and if not, it will show "could not read config file" error message. So you should turn off the detection of the parameter, add the code of below into the index.php: libxml_disable_entity_loader(false)

I hope this can help you. and I fix the problem use it.

For more information you can check the article: https://stackoverflow.com/questions/23489845/php-warning-domdocumentload-i-o-warning-failed-to-load-external-entity

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.