Solved: Magento 2 Error "An Error Has Happened During Appl

An error has happened during application run. See exception log for details. Could not write error message to lớn log. Please use developer mode to see the message

*
*

This is a common error that Magenkhổng lồ 2 users may encounter when upgrading Magenlớn 2 version or even after installing a new Magenlớn 2 instance.

Bạn đang xem: Solved: magento 2 error "an error has happened during appl

Some users reported lớn me that after failed to lớn nâng cấp Magento 2 version, they use rollback button to revert version & see this error message.

In this tutorial, we will learn everything about this error, the cause and solution.

Cause of the error

The error message only tells you that there’s a problem happening with Magento 2.

There are several causes of this error like

MySQL service not responding on your serverWrong commvà when installing Magento lớn 2.4Lachồng of Memory limit or max_execution_time

Each type of error has different solution, in the next part we will learn about all possible cause of this error và how to fix them

Solution

Quiông xã fix you should try first

First, run these comm& using ssh, it may immediately fix your issue. In most case, the issue happens because Magenkhổng lồ 2 code was not compiled.

Xem thêm: Những Cách Cua Gái, Cách Tán Tỉnh Crush 100% Là Đổ Dành Cho Dân Fa

php bin/magenkhổng lồ setup:upgradephp bin/magenkhổng lồ setup:di:compilephp bin/magenlớn setup:static-content:Deploy -fchmod -R 777 var/ generated/If the issue still persists, find more solutions below.

Different websites have sầu different causes of error. To find out exactly the cause of the error on your site we will need to enable developer mode lớn display detailed error messages

After enabling developer mode, if you see the following error message:

Exception ‘PDOException’ with message ‘SQLSTATE <1049> Unknown database

Sample error message

exception "PDOException" with message "SQLSTATE <1049> Unknown database "cqaugusta.com"" in G:Xxamphtdocsmagento2.1.2vendormagentozendframework1libraryendDbAdapterPdoAbstract.php:129 Stachồng trace: #0 G:Xxamphtdocsmagento2.1.2vendormagentozendframework1libraryendDbAdapterPdoAbstract.php(129): PDO->__construct("mysql:host=loca...", "root", "", Array) #1This means there’s a problem with your MYSquốc lộ service.

You can try restart MySquốc lộ using this command

service mysql restartOr double check if MySQL database information is correct in /app/etc/env.php

Cheông xã the following information

‘host’ => ‘localhost’,‘dbname’ => ‘magento2dbname’,‘username’ => ‘db-username’,‘password’ => ‘dbpassword’,dbname = database name, username = database username, password = database password.

main.CRITICAL: Exception: Deprecated Functionality: Function mcrypt_module_open() is deprecated

Sample error message

main.CRITICAL: Exception: Deprecated Functionality: Function mcrypt_module_open() is deprecated in /home/cqaugusta.com/public_html/hpe/vendor/magento/framework/Encryption/Crypt.php on line 54 in /home/cqaugusta.com/public_html/hpe/vendor/magento/framework/App/ErrorHandler.php:61Stachồng trace:#0 /home/cqaugusta.com/public_html/hpe/vendor/magento/framework/Encryption/Crypt.php(54): MagentoFrameworkAppErrorHandler->handler(8192, "Function mcrypt...", "/home/cqaugusta.com/...", 54, Array)#1 /home/cqaugusta.com/public_html/hpe/vendor/magento/framework/Encryption/Encryptor.php(401): MagentoFrameworkEncryptionCrypt->__construct("5c773093231aabe...", "blowfish", "ecb", false)If you see such error message > There was problem with thư mục permission

Run these command khổng lồ fix this issue

find . -type f -exec chgian lận 644 ;find . -type d -exec chgian lận 755 ;find ./var -type d -exec chthủ thuật 777 ;find ./pub/truyền thông media -type d -exec chgian lận 777 ;find ./pub/static -type d -exec chmod 777 ;chgian lận 777 ./app/etcchthủ thuật 644 ./app/etc/*.xmland

chown -R www-data:www-data /var/www/yourmagento2folder/

main.DEBUG: URI ‘/” cannot be accessed with HEAD method (MagentoCmsControllerIndexIndex)

Sample error message

main.DEBUG: URI "/"" cannot be accessed with HEAD method (MagentoCmsControllerIndexIndex) <> <>main.DEBUG: Request validation failed for action "MagentoCmsControllerIndexIndexInterceptor" <> <>main.DEBUG: URI "/checkout"" cannot be accessed with OPTIONS method (MagentoCheckoutControllerIndexIndex) <> <>main.DEBUG: Request validation failed for action "MagentoCheckoutControllerIndexIndexInterceptor" <> <>Run database update, clear cache, compile code to fix this

chthủ thuật -R 777 var/ generated/php bin/magenlớn setup:upgradephp bin/magenlớn setup:di:compilephp bin/magento lớn c:f

PHP Deprecated: The each() function is deprecated. This message will be suppressed on further calls in

Sample error message

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/html/vedic/vendor/colinmollenhour/cache-backend-file/File.php on line 81If you see this error message, try lớn downgrade or upgrade your PHPhường version (another version may probably fix your error

main.CRITICAL: Class MagentoFrameworkAppHttpInterceptor does not exist

Sample error message

main.CRITICAL: Class MagentoFrameworkAppHttpInterceptor does not exist "exception":" (ReflectionException(code: -1): Class Magento\Framework\App\Http\Interceptor does not exist at /var/www/magento/vendor/magento/framework/Code/Reader/ClassReader.php:26)" <>This error may happen when you install Magento 2.4 with Nginx as a reserve proxy

You can fix this by increase the proxy buffer in the Nginx conf file

hệ thống ... location / proxy_pass http://192.168.1.99; ... proxy_buffers 256 8k; proxy_buffer_kích thước 512k; proxy_busy_buffers_size 512k; ...

Wrapping up

I have sầu listed all the possible solutions to fix the issue “An error has happened during application run. See exception log for details Magento lớn 2”

In case you tried all the mentioned solutions but the error still persists, just drop a bình luận below with your error message (after putting Magento lớn 2 developer mode). I will be happy lớn help.