when I try to compile after setup:upgrade

It displays for me blank page with error in log file:

main.INFO: Broken reference: the 'logger' element cannot be added as child to 'after.body.start', because the latter doesn't exist [] []

I used this code too to display errors in index.php

ini_set('error_reporting', E_ERROR);
function fatal_handler() {
    $error = error_get_last();

The home page now display the following error

    [type] => 8192
    [message] => Function mcrypt_module_close() is deprecated
    [file] => C:\xampp\htdocs\magento\vendor\magento\framework\Encryption\Crypt.php
    [line] => 112

Any suggestion?


  • Refer this link to enable error in Magento2.
    – Pratik Oza
    Commented Jan 11, 2018 at 19:03

1 Answer 1


I Have been searching a lot since no body helped me.

and the below solution worked with me

The Solution as follows:

Note I use Ubuntu 17 and I'm on localhost

first need to edit apache2 configuration.

use any editor to edit the this file path


Replace the following lines:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted


<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted

restart apache:

sudo service apache2 restart

the problem after compile php bin/magento setup:di:compile and php bin/magento setup:static-content:deploy the folder /var magento deploy files and folders can't be accessed.

so need to do the following:

Make sure you are in the following directory.


then use the following Command:

sudo chmod 777 -R var

and this

sudo chmod 777 -R pub

Note: I don't know the right permissions for those two folders and I don't care cause i'm in localhost if you are in published website make sure the proper permissions for the files and folders. permisions with 777 can do security issue.

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.