Skip to main content
101 votes
Accepted

Magento 2 Allowed Memory exhausted error when compile code

A quick solution for memory limit in Magento 2 command is directly adding memory limit inside command. For Compilation command, php -dmemory_limit=5G bin/magento setup:di:compile For Deployment ...
Rakesh Jesadiya's user avatar
19 votes

Error after deleting all cache in Magento 2

You have to first remove var folder. Run command, php bin/magento setup:di:compile After remove var folder give permission to var folder, chmod -R 775 var/generation/ var/cache/ var/full_page/ ...
Rakesh Jesadiya's user avatar
16 votes
Accepted

Magento2 Correct Sequence to flush all Caches/Static files

Normaly you don't have to clear the folder manually. I use the following "rotation" For clearing the cache: bin/magento cache:clean For reindex new xml files: bin/magento index:reindex List item ...
Irv's user avatar
  • 526
15 votes

Magento 2 Allowed Memory exhausted error when compile code

use this 'dirty' way php -dmemory_limit=-1 bin/magento setup:di:compile
Ansyori's user avatar
  • 841
11 votes
Accepted

Generation of var/cache/ var/generation and var/di folders Magento2

var/cache is cleared by php bin/magento cache:flush. It rebuilds on the fly as data is cached by Magento (there's no command to rebuild, it just happens). var/di and var/generation are cleared by php ...
Ryan Hoerr's user avatar
  • 12.3k
10 votes
Accepted

Magento 2 - Fatal Error "Can't create directory" var/generation/Magento/

This is a permission problem, Magento is unable to write to your var directory. Please follow the official documentation to setup your permissions properly.
Raphael at Digital Pianism's user avatar
9 votes

after run bin/magento setup:upgrade got the error

Deleting var/generation, var/cache and var/di solved it for me.
Kaushal Suthar's user avatar
7 votes

Magento 2 Allowed Memory exhausted error when compile code

php -dmemory_limit=6G bin/magento setup:di:compile
Sheshgiri Anvekar's user avatar
7 votes
Accepted

Generate factory or proxy in unit tests: "ReflectionException: Class ...Factory does not exist"

The easiest way to deal with that is to run compilation before running tests: bin/magento setup:di:compile The other way is to explicitly define methods for the factory mock eg. instead of doing ...
Wojtek Naruniec's user avatar
6 votes

magento2 what exactly purpose of Factory class?

In general you use factories to instantiate non-injectable objects, like the cms page object. Some objects require user input to instantiate so you cannot inject them via the constructor. \Magento\...
Claudiu Creanga's user avatar
6 votes

Error after deleting all cache in Magento 2

If you're still having issues after compiling, removing the var/di folder & contents usually does the trick for me. No idea what actually causes this to happen though, I frequently run into it and ...
Eamonn's user avatar
  • 508
6 votes

Blank screen after compiling

Just follow : to debug blank white screen and CSS,JS page load design issue. open terminal run following command cd magento-root-folder php bin/magento setup:upgrade then don't compile just ...
lalit mohan's user avatar
  • 1,090
5 votes

Magento 2 Allowed Memory exhausted error when compile code

If you are using PHP >= 5.3.0 and you used the Magento 2.1.x and above, then after you run composer install, two files will be created in your root directory and your pub directory named .user.ini ...
Toan Nguyen's user avatar
  • 3,059
5 votes

Magento 2 proxy class override

After reading comments in which you've stated: I have done similar thing and it worked. I have settled with that solution. but i wanted to generate a new proxy class which had new methods included. ...
Ivan Chepurnyi's user avatar
5 votes

Magento 2 - Fatal Error "Can't create directory" var/generation/Magento/

This should help - it sets your permissions based on magento documentation. sudo find . -type d -exec chmod 770 {} \; && sudo find . -type f -exec chmod 660 {} \; && sudo chmod u+x ...
Collin Blake's user avatar
5 votes

Generate factory or proxy in unit tests: "ReflectionException: Class ...Factory does not exist"

Also you may use something like this private function getMockupFactory($instanceName) { /** Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ $objectManager = $this->...
Eduard Melnyk's user avatar
5 votes

Generate factory or proxy in unit tests: "ReflectionException: Class ...Factory does not exist"

The problem originates from PHPUnit mocking library, as it cannot autoload the needed class. If you take a look into Magento dev repo, it setups Autoloader catcher, that generates a class when it is ...
Ivan Chepurnyi's user avatar
4 votes

What Triggers the Generation of a Proxy in Magento 2

As you've probably noticed Magento 2 does not allow you to create an object without passing all dependencies. Proxies exist in case you have optional dependencies. For example <config xmlns:xsi="...
Raphael at Digital Pianism's user avatar
4 votes
Accepted

Magento 2: What are Generated Logger Classes For?

A Logger class is created by Magento\Framework\ObjectManager\Profiler\Code\Generator\Logger for each class which is generated or loaded using the ObjectManager. This is done in roughly the same way as ...
Vincent Hornikx's user avatar
4 votes

There are no commands defined in the "setup" namespace : Magento 2

This happens if any XML file defines in etc is not defined correctly. There could be a sequence problem or error in node defining Open cmd go to your Magento root directory and type the below command. ...
Abhishek's user avatar
  • 939
4 votes
Accepted

Scaling Magento 2 on multiple containers in production with generated code

Not sure why this question got downvoted; looking around the Internet there is precious little information about how people should run Magento 2 (Open Source or Enterprise) in a scalable, production, ...
geerlingguy's user avatar
3 votes

Magento2 Plugin with Proxy

From https://devdocs.magento.com/guides/v2.0/extension-dev-guide/plugins.html: Limitations Plugins cannot be used with any of the following: Final methods Final classes Any class that contains at ...
Yura Zabolotny's user avatar
3 votes

Magento 2 Allowed Memory exhausted error when compile code

This situation can be tricky to debug since if you just to php -r "echo ini_get('memory_limit').PHP_EOL;" it shows the memory limit for the PHP in your path, which might be fine. But the magento ...
Scott C Wilson's user avatar
3 votes

Magento 2 - Fatal Error "Can't create directory" var/generation/Magento/

Please change the generation folder rewrite permission. Thats work for me. sudo chmod -R 777 var/*
Liz Eipe C's user avatar
  • 1,296
3 votes

Magento 2 - Fatal Error "Can't create directory" var/generation/Magento/

in my case,I only execute,and the error disappeared ,as I do not want to chmod too many foders 777. cd var/generation chmod -R 777 Magento
bestshop24h's user avatar
3 votes
Accepted

Magento 2 some functions' definition does not exist

PHP comes with so called "magic methods". All Magento models utilize them, and in your case - __call As you can see in source: vendor/magento/framework/DataObject.php public function __call($method, ...
Bartosz Herba's user avatar
3 votes
Accepted

Add a block to programmatically generated widget

That error can be solved by using the following code inside your upgrade method. $this->state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML); public function upgrade(...
Nnie's user avatar
  • 46
3 votes
Accepted

Generating other classes beside the core ones

There is a complete lack of documentation on creating custom generators, but its a slight abstract of the Zend code generator. Which you will probs have a better time find documentation for. But in ...
Sam's user avatar
  • 1,910
2 votes

There are no commands defined in the "setup" namespace : Magento 2

This happens if any XML file defines in etc is not defined correctly. There could be a sequence problem or error in node defining Open cmd go to your Magento root directory and type the below command. ...
Abhishek's user avatar
  • 939
2 votes

Magento 2 Allowed Memory exhausted error when compile code

I run into similar problem, memory limit was increased to 2Gb inside php ini file, phpinfo() file showed it was set to 2Gb. It seems Magento set memory limit manually somewhere. I increased memory ...
JohnyFree's user avatar
  • 1,539

Only top scored, non community-wiki answers of a minimum length are eligible