execute drush command from devel/php drupal Can any one please tell me how can I execute drush command from devel/php?

I can execute PHP codes from devel/php. But I don't know how can I execute drush command from devel/php. (As we know "devel/php" URL coming from devel module).

I have written some custom drush command for cron purpose. I can able to run those commands from command line.

&gt; drush my-cmd or drush cc all or drush status , etc ... I can run it through command line.


Expecting some function as mentioned below to run from devel/php

some_function("drush cc all");
Someone tried to create a module to provide shell access from within a Drupal site, but it was never fully debugged. See the Drupal Terminal project.  Perhaps there have been advances in the jQuery terminal that might make it easier to get this working if someone revisited it.

If you want to exec Drush from within php, it is generally better to use drush_invoke_process() rather than exec("drush ...").

$values = drush_invoke_process("@site", "cc", array("all"), array("verbose"));


If you are just running a one-off command and you don't care about the command results, then exec("drush ...") is fine, though.