Hot answers tagged

55 votes
Accepted

Fatal error "Allowed memory size" while run setup:static-content:deploy

quick solution add memory size in the command : php -dmemory_limit=6G bin/magento setup:static-content:deploy change 6G to what you want
Ibnab's user avatar
  • 1,861
26 votes
Accepted

When exactly to use php bin/magento setup:upgrade

If you enabled one or more modules, then you will need to run magento setup:upgrade to update the database schema. By default, magento setup:upgrade clears compiled code and the cache. Typically, you ...
Toan Nguyen's user avatar
  • 3,049
16 votes
Accepted

Magento 2.3 : How to create product attribute via declarative schema?

I wrote an entire blog post about this. It is quite extensive and goes into detail about all of the intricacies: https://markshust.com/2019/02/19/create-product-attribute-data-patch-magento-2.3-...
Mark Shust at M.academy's user avatar
13 votes
Accepted

Magento 2 : Running magento 2 on windows using windows subsystem for Linux (WSL)

Introduction: The Windows Subsystem for Linux (WSL) is a new Windows 10 feature that enables you to run native Linux command-line tools directly on Windows, alongside your traditional Windows desktop ...
Vivek Kumar's user avatar
  • 5,030
11 votes
Accepted

When schema_version & data version will be different?

data_version is the version of data added via the data scripts. Those scripts are developed under the module folder under the Setup/InstallData.php and Setup/UpgradeData.php. schema_version is the ...
Raphael at Digital Pianism's user avatar
10 votes

Magento 2 - Setup page not displaying correctly

I fix this by the https://github.com/magento/magento2/issues/2504#issuecomment-159663316 Here is the code My nginx site config upstream fastcgi_backend { server unix:/var/run/php/php7.0-fpm....
Wen Wei's user avatar
  • 353
10 votes

Magento 2: What are `resources.xml` Files Used For?

I think the resources is relating to the actual database connection. M1 in the past had something like this: <resources> <backup_setup> <setup> ...
Kristof at Fooman's user avatar
10 votes
Accepted

Specific order for patch

To define a dependency in a patch, add the method public static function getDependencies() to the patch class and return the class names of the patches this patch depends on. The dependency can be in ...
Alex Lobster's user avatar
9 votes

There are no commands defined in the "setup:static-content" namespace

first run the cmd composer install in you folder then run this cmd php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy (or) php bin/magento ...
SNS's user avatar
  • 907
9 votes
Accepted

How to convert install/upgrade schema scripts to db_schema.xml files?

After writing my question. I found my issue: I had run the setup upgrade command before. So, I removed my module from setup_module table and my custom data table. Then I ran the two commands again. ...
Khoa TruongDinh's user avatar
8 votes
Accepted

Blank page instead of setup When install Magento2

Follow this Commands : php bin/magento setup:install --base-url="YourSiteUrl" --db-host="DBhost" --db-name="DBName" --db-user="DBuser" --db-password="DBpassword" --admin-firstname="admin" --admin-...
Prashant Patel's user avatar
7 votes

Magento setup directory cannot be accessed

Appending /setup to the install URL should resolve the issue. In your case that would be http://localhost/~myusername/magento/setup
Andrew B's user avatar
7 votes
Accepted

Composer installation fails with "failed to open stream: Too many open files"

You can up your system's file open limit on Linux or Max OS with the following: ulimit -n 10000 This should help with the composer issue.
David Manners's user avatar
6 votes
Accepted

Magento 2 add data to core_config_data

In your setup script: $data = [ 'scope' => 'default', 'scope_id' => 0, 'path' => 'design/footer/copyright', 'value' => 'Copyright © 2016 ...
Khoa TruongDinh's user avatar
6 votes

How to change the column in core table in magento 2

You can Modify the definition by upgrade script as below. <?php namespace Vendor\Module\Setup; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface;...
Mohammad Mujassam's user avatar
6 votes
Accepted

phpcs Use ::class notation instead warning on attribute source field

Strings can contain typos. You can not use the "jump to class" feature on strings from your IDE. Refactoring in an IDE will find ::class notations and not strings.
Philipp Sander's user avatar
5 votes
Accepted

Magento 2 Get Module Version Outside of the Setup Directory

Try \Magento\Framework\Module\ResourceInterface::getDbVersion('Module_Key'). And use a backend model, rather than a frontend model/input renderer. Like so: <?php namespace SalesIgniter\Rental\...
Ryan Hoerr's user avatar
  • 12.2k
5 votes

Magento 2 : InstallData.php Does Not Seems to be Running While setup:upgrade

Try the following way: namespace VVV\Comercial\Setup; use Magento\Customer\Model\Customer; use Magento\Customer\Setup\CustomerSetup; use Magento\Framework\Setup\InstallDataInterface; use Magento\...
Sohel Rana's user avatar
  • 35.7k
5 votes

Add an image product attribute in Magento 2 in module setup

You can add and extra attribute image to product entity using an InstallData / UpgradeData file in your module. Have a look to the following example: <?php // vendor/ModuleName/Setup/InstallData....
diazwatson's user avatar
  • 2,420
5 votes
Accepted

Magento 2.2.2 Web Setup Wizard not visible in backend

this is a known issue. since early 2.0 and still not fixed in 2.3.1 https://github.com/magento/magento2/projects/14#card-3854114 https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/...
MagenX's user avatar
  • 3,810
4 votes

What is the preferred structure of a Magento 2 project under VCS?

Shortish term, we are looking to separate files that need customization. E.g. if people need to modify index.php, work out how to separate the standard file Magento ships from the need of local ...
Alan Kent's user avatar
  • 3,488
4 votes

There are no commands defined in the "setup:static-content" namespace

Run below command php bin/magento setup:upgrade So above command will show error and according to that you can resolve error. Another option you can check error log in var/log folder. Generally ...
ParulThakkar's user avatar
  • 1,137
4 votes

Magento 2.4 Best way setup with Docker environment

You can use these files to setup you docker environment easy to use visit link - https://github.com/markoshust/docker-magento I hope so it will help you.
Sanaullah Ahmad's user avatar
3 votes

Magento 2: programmatically run setup upgrade

To do so you need to use the Magento/Setup/Model/InstallerFactory class. For example this is the code that runs when you call the CLI command: $keepGenerated = $input->getOption(self::...
Raphael at Digital Pianism's user avatar
3 votes

Magento 2: Upgrading a "Meta Package" Install

I just adjusted my composer.json file to use 2.0.4 instead of 2.0.2 (by hand), and afterwards ran composer update and php bin/magento setup:upgrade. Worked flawless in here. I believe the Magento ...
stefandoorn's user avatar
3 votes

What is the preferred structure of a Magento 2 project under VCS?

There is an easy Solution for your override Problem: don't change core Files ;) Magento is based on extending the Code and not changing it. First thing is, you should not put your whole app/code ...
David Verholen's user avatar
3 votes

Magento 2 add data to core_config_data

I thinking of other approach in which you should define your configurations in etc/adminhtml/system.xml and their default values in etc/config.xml Why are you trying to insert these configuration ...
Miroslav Petroff's user avatar
3 votes

There are no commands defined in the "setup:static-content" namespace

You have to call below command in your cmd, php bin/magento setup:static-content:deploy After run above command no error are display. Remove var folder and clear cache.
Rakesh Jesadiya's user avatar
3 votes

Magento 2 on shared hosting, Vendor autoload is not found. Please run 'composer install'

You can just download composer in Magento root directory and run it like php composer.phar install or download all locally, run composer install and upload vendor directory on the server.
KAndy's user avatar
  • 20.8k

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