Magento is a popular e-commerce content management system that allows us to manage our online store in a flexible and scalable way. Below, we explain how to resolve some of the most common errors you may encounter with Magento.
How to view error messages generated by Magento
Before reviewing the types of errors you may encounter with Magento, you need to know how to identify them. Magento is a CMS that manages its own errors and, when it fails, it displays a message like the following:
In the screenshot, we can see that Magento displays its own error code. To find out which error message it corresponds to, access your hosting account via
FTP and, inside the directory where Magento is installed, go to /var/report/.
Inside this folder, you will find a file that corresponds to the code shown on the website. If you open this file, you will see the error message that has occurred.
Most Magento errors must be checked this way in order to determine what is causing the issue.
Whenever we run a process in Magento, the hosting account must have a sufficient memory limit set so that the application can complete the process being executed. If the memory limit is insufficient, you may see an error similar to the following:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 1024 bytes) in /usr/home/example.com/web/lib/Varien/Object.php on line 270
To fix this, you need to increase the PHP memory limit. You can do this from the hosting Control Panel under
Configure PHP.
A similar error to the memory limit issue is the execution time error. When Magento attempts to run a process that requires more execution time, you may see an error like the following:
Fatal error: Maximum execution time of 30 seconds exceeded in /usr/home/example.com/web/lib/Zend/Db/Adapter/Abstract.php on line 0
To fix it, go to the
Configure PHP section in the hosting Control Panel and increase the execution time.
3.- Error establishing database connection Magento, like all CMS platforms, needs to connect to your hosting account’s database in order to function. If it cannot connect, you may encounter the following message:
Access denied for user 'usuariMySQL'@'localhost' (using password: YES)";i:1;s:2933:"#0 /usr/home/example.com/web/lib/Zend/Db/Adapter/Pdo/Mysql.php
In this case, the error occurs because the MySQL username and password are not correctly configured in Magento. To fix this, connect via
FTP and edit the local.xml file located inside /app/etc/ in the directory where Magento is installed.
When you open it, you will find several lines of code.
You need to verify that the data is correct. To find your hosting account’s MySQL connection details, go to the
MySQL section in the hosting Control Panel.
4.- The page does not load Sometimes, your Magento website may randomly fail to load. In some browsers, the error message ERR_EMPTY_RESPONSE may appear. When this behavior occurs, it may be caused by the PHP module APC.
To prevent this behavior, you can disable the use of APC through the
.htaccess file.
Inside the Magento .htaccess file, which you can access via
FTP, add the following line:
php_flag apc.cache_by_default Off
This should prevent the issue from occurring again.
5.- Changes are not applied When we apply changes in Magento, or even fix an error, we may find that no changes are visible. This happens because Magento uses a cache system and retains the previous state of the website.
We can regenerate the cache from the Magento administration panel, or, if we do not have access, we can connect via
FTP. Go to the directory where Magento is installed and then enter the /var/ folder.
Inside /var/, there is a folder called cache. Delete it.
Once deleted, access the website again and the changes should now be visible. At the same time, a new cache folder will be automatically generated.