Currently I'm manually putting my local environment proxy settings in my settings.php file like so:

 $conf['proxy_server'] = '192....';
 $conf['proxy_port'] = ####;
 $conf['proxy_username'] = 'myusername';
 $conf['proxy_password'] = 'mypassword';
 $conf['proxy_user_agent'] = '';
 $conf['proxy_exceptions'] = array('', 'localhost');

This works, but I work with a team, and the others on my team can see my login info when they enter the settings.php file. Plus when I change my password, I need to remember to change it here.

We're using Windows 7 machines. How could I make it so that Drupal automatically uses the logged-in user's credentials (like the way browsers seem to do) instead of hard-coding them into the settings.php file?

1 Answer 1


Sharing settings.php isn't good practice at the best of times.

Instead, it would be better to make that file specific to your own machine, and exclude it from version control. Have the rest of your dev team do the same. Then the problem is mostly solved, and you'll find it impossible to accidentally overwrite a production site's settings.php as a bonus.

Regarding automatically updating when you change your password - I think you're out of luck.

The way drupal_http_request() uses the proxy vars means you need to provide URL, username and password in plaintext as variables (i.e. the $conf array). I may be wrong, but I don't think you can get at those system credentials through PHP. Perhaps there's an extension that provides it, but I haven't come across one before. I'm almost positive core PHP doesn't have anything useful anyway.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.