Testing out the new direction for Drush, which has seen the matrix and can now step outside of Drupal
Testing the code in the Drush does NOT have to be a module! issue. Specifically, the ready-to-run tarball in comment #36.
First, it does not happen to work around some problem I have on my local computer, where I can't get Drush to find Drupal no-way, no-how with -l
or -r
or anything. Instead, any Drush command always returns a Drupal site offline message. Maybe my command line PHP doesn't find the same things as XAMPP's PHP, and as a result is finding some ancient installation of a Drupal site in Mac OS X's built-in localhost server that really is offline? Or rather, it looks for a version of MySQL that fails? I don't know but it doesn't work.
(See the busted local dev environment attempt, but know I'm moving to Linux soon.)
Ebony-II:drush.experimental.6 ben$ ./drush.php -r /sites/seacoastoutright/drupal/ status
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<title>Site off-line | Drupal</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="/misc/favicon.ico" type="image/x-icon" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/defaults.css?0" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/system.css?0" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/system-menus.css?0" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/maintenance.css?0" />
<link type="text/css" rel="stylesheet" media="all" href="/themes/garland/style.css?0" />
<link type="text/css" rel="stylesheet" media="all" href="/themes/garland/minnelli/minnelli.css?0" />
<link type="text/css" rel="stylesheet" media="print" href="/themes/garland/print.css?0" />
<!--[if lt IE 7]>
<link type="text/css" rel="stylesheet" media="all" href="/themes/garland/fix-ie.css" /> <![endif]-->
</head>
<body>
<!-- Layout -->
<div id="header-region" class="clear-block"></div>
<div id="wrapper">
<div id="container" class="clear-block">
<div id="header">
<div id="logo-floater">
<h1><a href="/" title="Drupal"><img src="/themes/garland/minnelli/logo.png" alt="Drupal" id="logo" /><span>Drupal</span></a></h1> </div>
</div> <!-- /header -->
<div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner">
<h2>Site off-line</h2> <div class="clear-block">
<p>The site is currently not available due to technical problems. Please try again later. Thank you for your understanding.</p><hr /><p><small>If you are the maintainer of this site, please check your database settings in the settings.php file and ensure that your hosting provider's database server is running. For more help, see the <a href="http://drupal.org/node/258">handbook</a>, or contact your hosting provider.</small></p><p><small>The <em>mysqli</em> error was: <em>Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (61)</em>.</small></p> </div>
(etc.)
Up on our test server where regular Drush does work, the new freed-from-the-matrix Drush works also!
(Note that despite the .gz, it's not actually gzipped, so untar without the -z
option works, and with -z
does not.)
ben@server:~$ wget http://cdn1.drupal.org/files/issues/drush.experimental.6.v5.tar_.gz
ben@server:~$ tar -xzvf drush.experimental.6.v5.tar_.gz
ben@server:~$ tar -xvf drush.experimental.6.v5.tar_.gz
It does not work on a site with an existing Drush module:
ben@server:~$ cd drush.experimental.6
ben@server:~/drush.experimental.6$ ./drush.php -r /var/www/seacoastoutright/drupal/ status
Get the existing Drush module out of the way and the Drush "unmodule" can work it's "I'm not in Drupal" magic:
ben@server:~/drush.experimental.6$ sudo mv /var/www/seacoastoutright/drupal/sites/all/modules/drush/ .
ben@server:~/drush.experimental.6$ ./drush.php -r /var/www/seacoastoutright/drupal/ statusDrupal is installed.
This is a running Drupal site, so it's not a test of the ability of Drush to run without a running Drupal instance.
Note that the Drush Package Manager currently provides a misleading message when it doesn't have the permissions to install a package. It appears to be blaming drupal.org, when really what you need to do is use sudo (or otherwise get write permissions to the directory the module will install in).
ben@server:~/drush.experimental.6$ ./drush.php -r /var/www/seacoastoutright/drupal/ pm install tagadelic
ben@server:~/drush.experimental.6$ sudo ./drush.php -r /var/www/seacoastoutright/drupal/ pm install tagadelic
In short, the new Drush works for what I used the old Drush for, without the need to install it in each site directory. Yay!
But we're barely scratching the surface of what Drush can do, and this re-architecture opens up new possibilities.
Comments
localhost problems
I had the same problems getting drush to work on in my local environment. I'm using MAMP. The problem, at least for me, was my command line PHP was not configured to connect to mysql.
(I'm making an assumption here about your issue. With the "Offline" error from drush printed to shell, I didn't at first see the error message among the HTML tags. I eventually saw it was a socket error.)
I started by create a phpinfo() script called
phpinfo.php
, I put it inside the Drupal install that I could run it just as easily from the command line and from the browser.<?php phpinfo(); ?>
Then I loaded phpinfo.php into the browser and noted the socket for MYSQL.
default_socket => /Applications/MAMP/tmp/mysql/mysql.sock
Next I ran the script from the command line grepping for mysql settings:
prompt: php phpinfo.php | grep mysql
The key was noting the php.ini was located in /etc. Totally different location from MAMPs. In fact there was no php.ini, so I created one from CLI php by copying /etc/php.ini.default
I then edited /etc/php.ini set the mysql and mysqli sockets as per my apache one.
mysql.default_socket = /Applications/MAMP/tmp/mysql/mysql.sock
mysqli.default_socket = /Applications/MAMP/tmp/mysql/mysql.sock
All good now.
Forgot to mention the CLI to
Forgot to mention the CLI to run to see where the php.ini is being included from. You don't have to grep, it's at the top of the output of phpinfo().
prompt: php phpinfo() | grep 'Configuration'
Showed me this:
Configuration File (php.ini) Path => /etc
Loaded Configuration File => (none)
Post new comment