Using a Unix socket for postgresql (for performance) as stated here: http://drupal.org/node/26836#comment-2417054

... causes this error (due to url escape):

The drush command 'cc all' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This error often occurs when Drush is trying to bootstrap a site that has not been installed or does not have a configured database.

Drush was attempting to connect to :
Drupal version : 6.20
Site URI : http://default
Database driver : pgsql
Database hostname : %2fvar%2frun%2fpostgresql%2f

Can a simple conversion patch be made for this problem? Thank you much.

Comments

greg.1.anderson’s picture

Assigned: Unassigned » greg.1.anderson

I use postgres with a standard dburl syntax, and it works fine. I'll try the performance-optimized socket syntax you suggest above and fix the URL escaping so that it works.

I presume that you have Drupal working just fine with your configuration settings.

threading_signals’s picture

Greg, yes, it's working fine with the Debian install, and I'm glad that you're going to try it. I've verified that postgresql is only accepting unix socket connections via netstat -tap and from configuring pg_hba.conf -- devel query times seems to be lower, and I like the difference. Thanks again for the look into this. Next for me is figuring out how to get memcached connected to Unix sockets. =) Drush has gotten me out of a jam from wsod, where it was unconfigurable via the browser, so it's a great tool in terms of a backup as well, I appreciate it. Paul

nathanweeks’s picture

Version: » 7.x-5.7
StatusFileSize
new1.01 KB
new555 bytes

Attached are a couple patches that add support for Unix domain sockets to drush 5.7 on Drupal 6.

The value of our $db_url in settings.php looks like this:

$db_url = 'pgsql://%2Ftmp:' . getenv('PGPORT') . '/drupal';

The patches allow the user name to be omitted from db_url, so peer authentication may be used.

The output of drush status looks like this:

$ drush status 
 Drupal version         :  6.26                   
 Site URI               :  http://default         
 Database driver        :  pgsql                  
 Database hostname      :  /tmp                   
 Database username      :                         
 Database name          :  drupal                 
 Database               :  Connected              
 Drupal bootstrap       :  Successful             
 Drupal user            :  Anonymous              
 Default theme          :  sky                    
 Administration theme   :  sky                    
 PHP configuration      :  /usr/local/etc/php.ini 
 Drush version          :  5.7                    
 Drush configuration    :                         
 Drupal root            :  /usr/local/www/drupal6 
 Site path              :  sites/default          
 File directory path    :  sites/default/files    
 temp                   :  /tmp   

Note that I didn't bother to fix drush sql-connect, which outputs a slightly-invalid connection string (empty username):

$ drush sql-connect
psql --dbname=drupal --host=/tmp --port=7152 --username=
greg.1.anderson’s picture

Version: 7.x-5.7 » 8.x-6.x-dev
Status: Active » Closed (won't fix)
Issue tags: +Needs migration

This issue was marked closed (won't fix) because Drush has moved to Github.

If desired, you may copy this bug to our Github project and then post a link here to the new issue. Please also change the status of this issue to closed (duplicate).

Please ask support questions on Drupal Answers.