Magento – Magento 2.2.2: problem with php bin/magento setup:di:compile

magento2.2.2

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);
register_shutdown_function("fatal_handler");
function fatal_handler() {
    $error = error_get_last();
    echo("<pre>");
    print_r($error);
}

The home page now display the following error

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

Any suggestion?

Thanks,

Best Answer

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

etc/apache2/apache.conf

Replace the following lines:

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

to:

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

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.

/var/www/magento

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.