Questions tagged [cli]
Denotes questions related to CLI which is a short form of Command-Line Interface
300
questions
88
votes
13
answers
197k
views
Magento 2 Reindexing - One or more indexers are invalid. Make sure your Magento cron job is running
I couldn't find the way to do reindexing in mass actions on magento 2.
Seems like you need to run it from cronjob. Is there an alternative way to reindex data in magento 2 from backend or command ...
33
votes
4
answers
72k
views
Magento 2 - There are no commands defined in the "setup" namespace on windows [duplicate]
I have a problem when I run this command:
php bin/magento setup:upgrade
Display error:
[InvalidArgumentException] There are no commands defined in the
"setup" namespace.
I found some ...
25
votes
7
answers
17k
views
Magento2 CLI module:enable gives error "Unkown module(s)"
In Magento2 I've built a simple custom module and want to enable it by CLI:
bin/magento module:enable Vendorname_Modulename
But it is giving me the following error:
Unknown module(s): '...
21
votes
2
answers
2k
views
Magento 2: What's a "static view file"
If I use the module:enable or module:disable command to enable or disable a module,
php bin/magento module:enable Pulsestorm_TutorialObjectManager1
php bin/magento module:enable ...
20
votes
6
answers
20k
views
Magento 2 run a specific Cron without cron:run CLI command?
To make a long story short xdebug will not reliably stop on the breakpoints in my cron files when using the typical:
php bin/magento cron:run
Xdebug is all setup properly and sometimes it will work ...
15
votes
6
answers
18k
views
Constant name is expected. Error
I am receiving this error:
Uncaught exception 'InvalidArgumentException' with message 'Constant name is expected.
While running php bin/magento setup:upgrade in command line.
i got this http://...
15
votes
3
answers
7k
views
How to create custom Module Development in magento 2 from Scratch?
How to create Custom Module Development from scratch in magento 2 with following point.
1.How to Create Module
2.How to Install and Upgrade Database
3.How to Create Module,view and Controller ...
15
votes
3
answers
1k
views
Magento 2 Shortcut/GUI tool to perform commandline tasks for windows
I know, that the command line tool for magento 2 is very useful, but when in development,we need to perform some common tasks like clear the cache, deploy static content, upgrade db, enable extension ...
14
votes
3
answers
29k
views
Magento 2 : Execute Cron
How can I execute Cron from command line manually.
In Magento 1.x we can run cron like :
www.testsite.com/cron.php
but in magento 2 how can I do this ?
Please also help me for how can I execute ...
14
votes
15
answers
30k
views
There are no commands defined in the "setup" namespace : Magento 2
I have installed the latest version of Magento 2, everything is working fine frontend, backend and functionality.
I have one issue with bin/magento setup:upgrade command, when I run this command in ...
12
votes
4
answers
4k
views
Magento 2 compile command fail, but no errors
The compile command suddenly stops, but there is no error.
[~/public_html]# php bin/magento setup:di:compile -vvv
Compilation was started.
Repositories code generation... 1/7 [====>----------------...
12
votes
3
answers
6k
views
magento 2 - In what case we need to run this command magento setup:di:compile?
In what case we need to run this command magento setup:di:compile ?
11
votes
3
answers
4k
views
MAGE_DIRS bootstrap parameters in CLI
In pub/index.php, the following code is used to set change URLs for media and static assets to omit "/pub":
$params[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] = [
DirectoryList::PUB => [...
10
votes
2
answers
8k
views
Magento2.3 setup:upgrade error
After being able to update magento to 2.3 (which was a pain by itself) I managed to get to the part where the database needs to be updated. Which is in current state when I try to run the command bin/...
10
votes
2
answers
8k
views
Magento 2: Disable all custom and Third Party Module in single Command
Is there is any way that we can disable all custom and third party Module in a single command? Currently, I am using below command to disable multiple modules
php bin/magento module:disable module1 ...
9
votes
3
answers
2k
views
Correct, Supported way to Add CLI Commands to Magento 2
Is there a correct, and officially supported way, to add your CLI commands to a Magento 2 module? From what I've gathered your options are
Add your command class to the commands argument of Magento\...
8
votes
3
answers
2k
views
Magento2 which command Run and when to Run
Kindly Clear Difference Between php bin/magento cache:flush and cache:clean and when they need to Run . which tasks Output to need cache:flush or clean ** and which task need these Commands => **di:...
7
votes
1
answer
4k
views
Magento 2 - How to run fast command line setup:di:compile?
How to run fast command line setup:di:compile.
I was waiting so long, if can you show me why?
7
votes
1
answer
117
views
Magento module:uninstall orphans any dependencies (required modules)
I have some modules that are dependent on a core module. When I use the command
composer require stti/module-catalogbook
Magento installs 2 modules.. Stti_Catalogbook and Stti_Catalogcore. If i ...
6
votes
2
answers
7k
views
Install Magento 2 on different mysql port
I have my nginx running on port 8080 and mysql running on port 3307. I want to install magento 2 cloned from git using CLI. Any idea how to configure the database which will use the port number 3307.
...
6
votes
1
answer
3k
views
Magento 2: How to display error message in CLI
I have an indexer, which needs to be configured first - requires API credentials.
When I run in a reindex command in CLI: $ bin/magento indexer:reindex my_reindexer_name and the API credentials are ...
6
votes
2
answers
5k
views
Magento 2: programmatically run setup upgrade
My Client wants me to write code to :
programmatically upload a customized module and then
enable the module(php bin/magento module:enable VENDORNAME_MODULENAME) and then
upgrade the system(php bin/...
6
votes
3
answers
1k
views
CLI: What is the difference between "setup:static-content:deploy" and "dev:source-theme:deploy"?
I wanto to know the difference between:
php bin/magento setup:static-content:deploy
and
php bin/magento dev:source-theme:deploy
I know that second receives as options name of specific vendor, ...
6
votes
3
answers
7k
views
Magento 2 bin/magento not working as it should
I've just installed a fresh copy of Magento 2.1.2 from composer. I've previously installed Magento 2 in a different directory completely fine and the commands all run as they should. This has only ...
5
votes
4
answers
18k
views
How we can install magento 2.2.0 via command line comand?
How we can install magento 2.2.0 via command line command(CLI) using Ubuntu ?
Could you please some share command?
5
votes
3
answers
11k
views
Magento 2 "Area code not set" warning in 3rd party module
I have a third party extension that i'm trying to install on a Magento 2 site i'm building. When i try and run setup:upgrade i get the error:
[Magento\Framework\Exception\SessionException] Area code ...
5
votes
3
answers
8k
views
How to configure Magento 2 Theme/Design via the Command-Line?
I'm doing some server configuration related tasks and was looking for a way to configure the theme of a store/website via the command-line.
I'm setting up a store with a custom theme (e.g. "Vendor/...
5
votes
2
answers
3k
views
Why my bin/magento setup:upgrade is really slow?
Running this command seems incredibly slow taking around half an hour+. I feel like it didn't always take this long and am wondering if this is normal and if not what can cause this?
This is a very ...
5
votes
3
answers
3k
views
After upgrade bin/magento not working
After upgrading my local instance of magento 2.1 to 2.1.2 the bin/magento tools stopped working. I do not get an error or any output. For instance when I run php bin/magento setup:upgrade after ...
5
votes
3
answers
3k
views
Magento2 bin/console commands returned empty
I'm wroking with Magento 2.1.1 (with PHP 5.6) and when I try to run a bin/magento command I'm getting nothing.
No error, no message, nothing.
I didn't found any special message on logs.
Has anyone ...
5
votes
1
answer
174
views
Is it possible to get the Magento indexer to display % complete?
Right now you are left wondering what is going on during indexing, especially on large catalogs where it takes hours to complete just one index.
Is there an easy way to get the command line indexer....
5
votes
1
answer
136
views
How to install extensions manually on Windows?
I can install extension manually using the 'mage' shell script on Linux - but is there an equivalent tool for Windows?
5
votes
1
answer
5k
views
Magento 2: How to fix incorrect permissions after executing setup:upgrade and/or setup:di:compile
After running setup:upgrade and di compile from the bin directory, permission and ownership is reset and the magento store stops working. It works if I manually reset the permission.
When the var/...
5
votes
1
answer
941
views
Magento 2.2.5 After Upgrade To 2.3 CLI commands don't work
I upgraded magento version by documentation, after upgrade this happens:
When running php bin/magento cache:flush or any other bin/magento command error appears
There are no commands defined in the "...
5
votes
1
answer
177
views
Problem with CLI
Hello i have an error of every command i press in CLI.
Following this Error
Deprecated Functionality: The each() function is deprecated. This
message will be suppressed on further calls in
/var/...
4
votes
6
answers
16k
views
How to remove captcha in via terminal?
I want to remove the captcha and its input field from the forgot password form and admin.
Please help me to remove that.
4
votes
3
answers
17k
views
Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory
I created module magento 2,but module can't run and errors exist Please upgrade your database: Run "bin/magento setup:upgrade from the Magento root directory. "
i tried to run command bin/magento ...
4
votes
5
answers
30k
views
PHP Fatal error: Uncaught Zend_Cache_Exception
SOLVED - see my answer below.
I changed my theme and all pages showed only html without any styling. Then I ran sudo php bin/magento setup:static-content:deploy and after website doesnt work and ...
4
votes
1
answer
10k
views
Magento 2 - bin/magento No commands working - Class 'Cli' not found Error
PHP Fatal error: Class 'Cli' not found in
/home/xxx-xxx/public_html/bin/magento on line 31
xxx-xxx@rck:~/public_html$ php bin/magento
No lock file found. Unable to read locked packages#0
/...
4
votes
4
answers
9k
views
getting error: Class Magento\Indexer\Model\ResourceModel\Indexer\State\CollectionFactory does not exist
When i run command for indexing
php bin/magento indexer:info
Error was thrown
Class Magento\Indexer\Model\ResourceModel\Indexer\State\CollectionFactory does not exist
[Magento\Framework\...
4
votes
4
answers
173
views
Magento CLI options to check Security patch applied or not?
Is there any CLI options to check security patch is applied or not ? How many are pending.
I have tried with online tool magereport and many of patch status is unknown. That is why am asking for a ...
4
votes
1
answer
6k
views
How the "magento setup:store-config:set --base-url" command exactly works?
I was thinking that such command was the same as setting the Base url from the Magento admin panel, from Configuration / Store / Web / Base Urls, but after some try it seems it is not the same.
When ...
4
votes
6
answers
5k
views
Cronjob issues with APC
I used the following command to setup my cronjob:
sudo crontab -e -u www-data
and the actual cronjob:
*/5 * * * * /bin/sh /var/www/cron.sh >/dev/null 2>&1
I also have APC running on my ...
4
votes
1
answer
2k
views
Console command waiting for input from user
It is possible in PHP to create console command waiting for an input from user like this or like this. Is there any 'magento-way' or above approaches can be used?
4
votes
4
answers
4k
views
Magento 2.0 Stable - Enabling Custom Module gives error
Download
Today I downloaded the Magento 2.0 Full Release from the Magento website. I downloaded the Full Release with Sample Data (ZIP with sample data) and installed it. I wanted to test if my ...
4
votes
2
answers
164
views
Why can't I access my custom cache key via CLI when it was set through a web request?
I have a method that calls the following code from a web request.
Mage::app()->getCache()->save('bar', 'foo', array(), 60*5);
I have another method that calls
Mage::app()->getCache()->...
4
votes
1
answer
2k
views
bin/magento cron:run running for a long time
the bin/magento cron:run entry in my crontab seems to cause a rather high load on the cpu (php's and mysql's cpu usage are permanently both at around 25% each) - I checked by disabling the crontab ...
4
votes
0
answers
321
views
Magento 2: Setting theme ID is not working by using config:set
I found xpath design/theme/theme_id in vendor/magento/framework/View/DesignInterface.php:28.
I'm trying to set new ID and there is an error:
magento config:set design/theme/theme_id 7
The "design/...
3
votes
3
answers
6k
views
Magento reindex from command line, still having timeout error
I'm trying to reindex my catalog_url_rewrite table (Magento website) through the command line using the command "php indexer.php --reindex catalog_url" in /shell. I get the following error:
PHP Fatal ...
3
votes
3
answers
2k
views
Magento 2: Controlling M2 via command line – when and why to use each command
When making changes to my Magento 2 site, I usually run a few of the command line commands to 'refresh' my site to see the changes I've made. The problem is, I'm not too sure what each command really ...