Magerun Tips

Quick Tip: Find login issues with sys:check command

Sometimes it’s not possible to login to Magento Admin Panel.
Searching for a solution can be very frustrating.

One of the most common purposes for this is a wrong configuration of the cookie domains.
Another problem is that Magento searches for a dot in the hostname.
Also wrong directory permission can cause this issue.

To prevent manually checks you can use the sys:check command bundled with n98-magerun.
All the sys:check commands are created by netz98 employees who had the same problems over the last month.

Magerun Tips

Quick Tip: PhpStorm command line tool support

This quick tip shows you how easy it it to integrate n98-magerun in your PhpStorm IDE.

Download n98_magerun.xml file for PhpStorm command line tool support


New release 1.76.0

The new n98-magerun release brings four bug fixes and two new commands and many internal docblock cleanups. A big thanks goes to Dmitriy Zavalkin who creates the new commands and added missing code blocks. We love to see how the community pushes the tool every week with active bug reports and pull requests on github.

Module Dependencies

There are two new commands which investigates how modules depend on each other.

Show list of modules which given module depends on:

Show list of modules which depend from module:


Permission error some servers
We now don’t stop in every case if n98-magerun cannot read in every directory. This minimizes many permission problems.

Exported setup script with attribute uses incorrect Setup class (by Jonathan Day)
A wrong setup class was fixed.

Doesn’t run when /tmp/magento/var exists and database is not created / tables missing
On malformed databases we don’t stop execution anymore. Now we print an error message and other commands which not needs a fully initialized
Magento can work. This helps to develop sanity check commands in the future.

Error with dev:module:rewrite:conflicts
We fixed a problem if a class contains errors and could not be initialized.

Have fun with new new n98-magerun version!

Magerun Tips

Quick Tip: Command Alias

Every developer is using n98-magerun in a different way. Some uses the cache:clear command multiple times a day.
For this we have support for command aliases to simplify the usage.

Making aliases is nearly the same as unix bash aliases. You define an alias and n98-magerun will run the alias instead.

Register alias

Aliases can be defined in any config. For personal use you can add the config in your home folder in file ~/.n98-magerun.yaml

Example Config:

If you run i.e. “n98-magerun.phar test-customer” a new customer with your defined data will be created.
This is very useful and saves a lot of time.

To bust the cache a simple “n98-magerun.phar cf” will do the job.

Happy working with n98-magerun!


New release 1.75.0

A new n98-magerun release spreads the world.
Here are some details about the new release:

Internal Symfony packages updated

The Symfony compontents i.e. the embedded Console component are all updated to current release 2.3.3.
The console component comes with a new table helper. We replaced all internal calls to our table helper to
the new native helper.

If you like to see how the table helper works, you will find a good overview in Symfony Blog

Warning if running as root

We decided to show you a warning if you run n98-magerun as root user. This can cause permission problems in combination with a different web user like “www-data” i.e. if you run a reindex and no “lock” file for a process exists in the “var/locks” folder.

Easy multi reindex

A new feature for the “index:reindex” command is available. If you like to reindex not only one index it’s now possible to specify multiple indexer with comma seperated codes from the command line.


It’s also possible to specify it from menu if no code was passed over the command line.

Easy admin login

The open-browser command can now open the Admin-Login-Page.


Bugfixes and minor changes

  • Issue #116 – Added “report_compared_product_index” and “report_viewed_*” tables to “log” group
  • Fixed issue #164 – dev:ide:phpstorm:meta debug mode isn’t enough verbose to detect where the problem is
  • Fixed issue #187 – Cache flush is not compatible with older versions of Enterprise

I hope you like the new release.
If you find any problems, please create an issue on Github.

Please update with:

Magerun Tips

Reset admin user password

This is only a quick tip.
But in some cases you need to reset a admin user password i.e. if you imported a dump
as developer and have no admin credentials.

There are two commands for that.

Create a new admin user

Creates a new admin user in interactive mode.

Change password of an existing admin user

You can list all admin users with admin:user:list command and should see a list like this:

Now you can change the password with this command:

Hope this helps you a little bit.

Magerun Tips

Customize database dump for development

Sometimes it’s useful to dump a production database and import them on a local developer workstation.
In this case we have some issue to solve.

Legal Issues

A production database contains many critical privacy data like customer addresses, email, hashed password, orders
which can produce big trouble if a hacker or someone can access it.
For a development workstation it’s a good advice to exclude the data. In most cases a developer needs no customer data
to create a new module.

Log data

Magento produces many log data. Some tables grow up and can contain many millions of records.
An import of a database could run up to hours. This is unpractical and unwanted for development.

n98-magerun strip option

n98-magerun can help you. The database command comes with a handy strip option.
If you run n98-magerun with –help option you can see this:

Magerun Tips

Dynamically disable n98-magerun commands

In some cases you like to disable your commands i.e if you are running n98-magerun on a production machine or if it doesn’t support the entire operating system.
The symfony command component have a simple solution for that. All commands are extended from the symfony command base class Symfony\Component\Console\Command which defines the method
isEnabled for that. The method must return a boolean value.

If you want to disable a command for older n98-magerun versions (interesting for module developers)
you can do it like this:

If you want to disable a command for a operating system you can use a utility class which is available inside of n98-magerun (We will provide a additional post for the utility classes in the future).

Or the hostname (here hardcoded):

You can see it’s pretty simple to disable a command.

Happy coding!


Introducting the new n98-magerun module system

Since version 1.72.0 n98-magerun offers you a new possibility to share your commands and configuration. Modules can be created in a easy way.
In the past it was hard to share own commands within a developer team. Every team member must manually add configuration to a config file.
Now it’s possible to manage the configuration in a single file inside the module which can be updates by a VCS like SVN or GIT.

Module Structure

A module in the simplest form exists as a single folder with a config file which must be named n98-magerun.yaml.
The config file must be placed directly in the module folder. If you have created some commands in the past you will see that the confiuguration
format is nearly the same. Nothing really new. The new big thing is that n98-magerun will search automatically for modules in some defined basse folders and merges all found config files.

Magerun Videos

Detect Magento Rewrite Conflicts