I mean drush and db credentials from external sources. Looks like OP has no clue how php.ini files works within CLI environment. He even posted snippet showing drush is using other php.ini than the one he defined his parameters in. On the other hand smart use of drushrc and ini_set() could do it. But again, he knows about drushrc, knows about ini_get(), and yet he looks like he failed to see "See also" block on ini_get() php.net page and notice ini_set() there.

For me it's between Questions that lack any research effort, too broad and unclear (due to lack of info why credentials ended up in php.ini in the first place). Not quite far enough either way for me to vote, but not really good none the less.


The question the user is asking is:

How can I give the right database credentials to Drush? Can I define something in drushrc files per project?

I take it as asking "If Drush is using the php.ini file I am not expecting, is there any other way to tell Drush what the database credentials are?" I think it is a question about Drupal.
I assume the user doesn't want to duplicate too much lines in the php.ini files used from PHP in the different environments.

The fact the user knows about drushrc doesn't mean the user knows everything about that file, or any tricks that could be used to solve the issue.

Also, why the user decided to choose that method for telling Drupal the database credentials is irrelevant for answering the question. If the users who answer the question want to point out that method is not preferable, or any issue with using that method, they are free to do it, after they answer the question.

  • But doesn't probably not even looking at help pages about ini_set() (and probably ini_get() too, as they are mutually linked there) count as lack of minimal own research? I mean, he switched to a function and seems not to even know about it's sister functions, ones that are simple and well documented. Isn't it a question that lack research effort? I'm not saying it is, I just wanted to express my doubts. – Mołot Aug 22 '13 at 9:09
  • What reported in the documentation pages for ini_get() and ini_set() is probably irrelevant for the user, if there is a Drush way to change the database credentials it has already gathered from the settings.php file. – kiamlaluno Aug 22 '13 at 9:15
  • Wait, how? You can specify default multisite site in drushrc, so it has to be executed before settings.php, doesn't it? After all settings.php must be loaded after site is determined. – Mołot Aug 22 '13 at 9:20
  • The point is that the question is about Drupal, since the user is not asking why PHP is picking up the wrong php.ini file. If there isn't any way to do what the user wants to do, then the answer will be "It is not possible." – kiamlaluno Aug 22 '13 at 9:29
  • Agreed 100% here. The question is very clearly about Drupal. The answer may involve PHP configuration. – mpdonadio Aug 22 '13 at 13:03
  • 1
    You can specify default multisite site in drushrc so it has to be executed before settings.php... The OP might not know that or not be thinking along those lines - all good information to either request clarification for in a comment, or as an addendum to an answer :) I think we have to exercise a certain amount of good faith; as @MPD and kiamlaluno said the question was asked very much from a Drupal perspective. And even if the answer would ultimately be related to server config, think how many more Drupal folks with the same problem that knowledge might help in the future – Clive Aug 22 '13 at 18:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .