What is Error 503 in Magento Store?… Learn How to Fix It

Error 503 in Magento Store

Building an e-commerce store using Magento may be easy when it comes to handling various issues. From the developer’s point of view, e-stores often need high performance. So, it is important to resolve any issue at earliest.

Though there are many errors, if I talk about 503 error, it is often experienced when magento extensions are installed and due to problems with the site’s server. Let’s check in brief what is this error and how to resolve it:

What is the 503 Error?

Sometime when the user opens an e-commerce site, the site shows get the message of unavailable service. It is due to 503 error. The error 503 means that the server is not available and under the maintenance mode.

When We Get This Error?

During the Magento installation, Magento will create “maintenance.flag”. Most of the times it will get removed automatically after installation but when it is not removed, users get the message “service temporarily unavailable”. This error message appears while opening the site.

How to Resolve this Error?

When we get this error, we may feel it is not easy to resolve but the solution is simple. Check below how will it get resolved:

  • Navigate to Magento root folder and look out for “maintenance.flag” file in the var folder. After that disable the maintenance mode.

Steps:

  • Login into cPanel of your Magento store.
  • Go to Magento root folder.
  • Delete the file var/.maintenance.flag.
  • Refresh cache from php bin/Magento cache:flush or via the admin panel.
  • If message “Exception printing is disabled by default for security reasons” appears, check the error log.
  • If an error like “Please Upgrade your database” occurred than run php bin/magento setup:upgrade from the root directory.

What is “maintenance.flag”?

maintenance.flag is a file consisting code which blocks the user to visit the particular site. This look like as below:

$maintenanceFile = ‘maintenance.flag’;

$ip = $_SERVER[‘REMOTE_ADDR’];

/***************

* IP’s allowed in maintenance.

* Use publicly visible IP addresses on LIVE, local if on DEV

***************/

$allowed = array(‘10.0.0.100′,’10.0.0.101′,’10.0.0.20’);

if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) {

   $basePath = dirname($_SERVER[‘PHP_SELF’]);

   include_once dirname(__FILE__) . ‘/errors/503.php’;

   exit;

}

Resolving the Magento 503 error is simple and easy. The solution is presented above is in the simplest way possible. Just you need to delete to rename or remove the file name “maintenance.flag” created in the root directory while installation of hosting service.

Share Array