How to set CRAFT_PLUGINS_PATH when invoking a console plugin action I have an install where I've moved the plugins/ directory outside of the craft/ directory. I've set CRAFT_PLUGINS_PATH in index.php and for web requests everything works fine.

Now I need to run a console command defined in a plugin. When I invoke the console from my shell, the default (incorrect) value for CRAFT_PLUGINS_PATH is set and my plugin's console command is not available.

I've currently worked around this by wrapping craft/app/etc/console/yiic.php, setting the constant before requiring yiic.php like so:

#!/usr/bin/env php
&lt;?php

define('CRAFT_PLUGINS_PATH', realpath(dirname(__FILE__) . "/../plugins").'/');

require_once(dirname(__FILE__).'/../craft/app/etc/console/yiic.php');


Is there a better way to do this / am I missing something?
Nope, you've done it the best way in Craft 2.

The upcoming Craft 3 treats console requests as more first class citizens like requests so it's not nearly as awkward using them.