I have Drush installed via the PEAR channel on my Ubuntu VM. Executing `drush dl` downloads the latest version of Drupal (currently 7.15). Viewing the downloaded Drupal install in my browsers shows me this:
Parse error: syntax error, unexpected '>' in /mnt/hgfs/Sites/dlkw.local/public_html/includes/bootstrap.inc on line 3382
However, when I download and extract the gzipped install file normally, everything works as expected. No syntax errors:
wget http://ftp.drupal.org/files/projects/drupal-7.15.tar.gz
tar xzf drupal-7.15.tar.gz
Output of `drush dl -d` can be seen here: http://pastie.org/4466396
Now here's the kicker. If I open bootstrap.inc in my text editor (Sublime Text 2, which detects the file as UTF-8), make NO edits and immediately save the file (again as UTF-8), bootstrap.inc now functions correctly and I now have a new error in my browser:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ')' in /mnt/hgfs/Sites/dlkw.local/public_html/modules/system/system.install on line 3031
Again, open in text editor, save, and the error moves on to the next file, and so on and so on.
$ drush --version
drush version 5.6
$ php -v
PHP 5.3.5-1ubuntu7.10 with Suhosin-Patch (cli) (built: Jun 19 2012 00:54:01)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.04
DISTRIB_CODENAME=natty
DISTRIB_DESCRIPTION="Ubuntu 11.04"
Comments
Comment #1
robschmitt commentedI now have a little more information that might help to shed some light on the problem. When I run `drush dl`, I'm running it from within my Ubuntu VM, but in a directory that's shared from the guest operating system (OS X). Run like this, I get the errors as I have described above.
However, if I run `drush dl` from within my home directory on the VM (a directory NOT shared from the guest OS), and then move the downloaded Drupal directory to the shared directory, it all works as expected.
So, I can say with surety that running drush from within the directory shared from the guest OS does not work as expected. However, when I simply wget and extract the Drupal installer from within this shared directory, it does work as expected.
I have also managed to discount symlinks as a possible cause of this issue.
Comment #2
greg.1.anderson commentedNote that the file
/mnt/hgfs/Sites/dlkw.local/public_html/includes/bootstrap.incis part of your Drupal install; it is not part of Drush. If you run drush from your home directory, it will run "bare", and will not involve your Drupal site at all. If you run it from within the Drupal root of your Drupal site, then Drush will attempt to bootstrap your Drupal site first. This is why you are getting the syntax error in one instance, and not in the other. Open up the file in question, and look at the reported line. Is there in fact a syntax error there, perhaps caused by a spurious character inserted accidentally into the file? Try re-installing Drupal, and see if the problem clears up.