Synology and Drush 8.1.16 – Finally Working

Yep, it’s Tech Monday on a Wednesday again…

Okay, so I’m lumbered with these Fisher Price “My First Server” things.  They run Linux (Yay!) but a strangely butchered and hobbled version (Boo!) and as I need them to run Drupal, I need to get some things working properly.  And, of course, they don’t have APT or RPM on there, that would be too easy.  And by “things”, I mean Drush – essential for command line maintenance of all your Drupal sites.

Apologies for the technical nature of this post, I didn’t have time to paint it or build it to scale.

First thing needed is php7.  Synology has a package for php7, so that’s not a big problem.  It’s currently stuck at 7.0 but I expect we’ll see 7.1 and 2 soon (for a certain definition of “soon”, it took them long enough to get MariaDB 10 on there).  Install that package and you’re good to go forward.  Once the package is installed, nip into the configuration website and enable ALL THE EXTENSIONS EVER.

Drush itself.  First off, I had to create my own home directory as somewhere to put things that stay vaguely safe between DSM updates.  Weirdly, my Synology boxes didn’t create home directories for users (you know, the way normal operating systems do), so there were chunks of things always throwing errors.   Do this for your username…

sudo mkdir /volume1/homes/<username>

Sorted.  Golden.  Etc.  You’ll probably need your root password to do this, then you’ll need to chown it to your user before you can use it properly…

cd into that directory, head over to http://docs.drush.org/en/8.x/install/ and grab the latest 8 release from GitHub.  At time of writing, it’s 8.1.16

Okay.  This is where it gets technical.  More technical, sort of.

Sure, you could just run

php70 ~/drush.phar pm-update

But (a) it’s tedious to type that in all the time and (b) it’ll fail because pm-update calls php pm-updatestatus and that’ll fail because php is not the same as php70 and doesn’t have all the extensions installed.

So we need to perform some surgery in /bin.

Step 1.  Get /bin/php to point to the *right* php.

sudo su
<password>
cd /bin
mv php php56
which php70
(assuming /usr/local/bin/php70, if not then substitute appropriately)
ln -s /usr/local/bin/php70 php
exit
php --version

Now when you run php –version you’ll see a lovely, shiny, 7.0 there instead of the dull, old, tedious 5.6.

Step 2, get Drush in place.

sudo su
cd /bin
cp /volume1/homes/<username>/drush.phar drush
chmod a+x drush
exit

Now you can run drush from anywhere on the server, without having to specify a version of php or a location for the drush.phar file.  Ain’t that a treat!

And if you’re being clever, you’ll see that you could have both drush 8 and 9 installed at the same time – just have different filenames in /bin – you could have “Doctor” running drush 8 and “Master” running 9.  Jeeves and Wooster.  Armstrong and Miller.  Bonnie and Clyde.  Any pairing you like, really.  Or you could be boring and have “drush8” and “drush9”.  Up to you, really.

Word of warning 1 – If you do this to /bin/php it will alter your default command line php for everything.  Shouldn’t be a problem, in fact it will probably make life easier.  But worth bearing in mind if you suddenly start getting weirdness with scripts you’re triggering through cron jobs (and don’t get me started on Synology’s implementation of cron, that makes no sense).

Word of warning 2 – There will come a day when, totally unexpectedly, you’ll type “drush” and your Synology box will reply with “What the f*ck is drush?” Or the Linux equivalent, usually a bit more polite – imagine Jeeves stepping smartly yet unobtrusively forward, coughing politely, whispering “I’m terribly sorry, sir, but I can’t find that command”, then stepping back into the butler’s pantry.  This means your Synology box has updated the Disk Station Manager software and reset ALL of your configuration tweaks.  Go back into php.ini and reset that max_upload_size from 32M again.  Fix those timeout values.  And redo steps 1 and 2, above, assuming you’re lucky enough to still have a home directory with drush.phar in it.

If this has helped you, good.  And I hope you find a way to get to a real server sooner rather than later!

MishAnt Design – Shameless self-promotion ahead

We interrupt the regularly scheduled tales of children, chickens and guarden clearance to unveil MishAnt Design!

If you need a website, have a website but want it managed, updating, refreshing, given a responsive design makeover, optimising for search engines or anything else vaguely webmastery, then MishAnt Design should be your first port of call.

WordPress wrangling?  No problem.  In the past I’ve recovered corrupt databases, identified suspect plugins, re-themed and tweaked sites to users’ requirements.

Drupal?  From simple sites for community groups through to complete sites mapping thousands of pieces of disparate data from across the Viking world, Drupal holds no fears for me.  Upgrading from earlier versions, no worries – my test servers can cope with just about any combination of plugins and themes.

MishAnt Design.  For all your website needs.

Thanks.

#Listography – Top 5 Websites

An interesting challenge from Kate Takes 5 this week.  My top 5 websites.

Working in IT I spend a huge amount of time on the web trying to solve problems, learning new stuff, writing/coding sites of my own.  If I picked the sites that appeared at the top of my bookmarks list I don’t think you’d be inspired!

  1. http://drupal.org – Home of my content-management-system of choice. An excellent piece of infinitely extendible software but kind of like using a sledgehammer to crack a walnut for some of the uses I’ve put it to!
  2. http://www.php.net – Documentation for my favourite programming language.
  3. http://css3clickchart.com – Reference for all the fun stuff you can do with the new style sheet specification (if you don’t know what that means, you probably don’t need to know.
  4. http://jqueryui.com/ – Making websites look good no matter what browser you’re using.
  5. My test server.  I’ll omit the IP address as it wouldn’t work anyway. It’s where projects go to before being released out into the wild so I can tear them apart with development tools.

Not an inspiring list, not unless you’re doing Drupal development or hand-coding stuff.

So.  The other websites.  The ones I really go to…

  • Google Reader – www.google.com/reader – I’m a fan of Google’s products and the Reader is one of my favourites.  It’s an online newsfeed reader.  You know those little “RSS” icons you see on blogs and websites?  There’s a couple up at the top of this page.  They link to the reader and every time a site is updated you get a new item in your news feed.  The reader also syncs with an excellent mobile app so I get the same feeds at the same points on my phone as I do online.  This is one of the 6 tabs I keep pinned open at all times.
  • Toodledo – www.toodledo.com – Online task manager.  Syncs to a mobile app (Pocket Informant on Android).  Similar to “Remember the Milk” but different.  I’m a fan of these “Getting Things Done” sites and I’ll try a different one every year or so.  Toodledo was my site for 2011 and it’s carried over into 2012.
  • If This, Then That – ifttt.com/ – A new discovery for me, If This, Then That connects things together.  “If I create a new post on my blog, post it to Facebook” is the sort of thing it does – only with hundreds of possible combinations of things.  Excellent discovery, excellent site.  Best thing is, no plugins needed for your blog. It just knows.
    If This, Then That
  • Twitter – twitter.com/#!/dogbombs – I know Kate’s mentioned Twitter herself, but it’s such a superb site that I couldn’t let it pass.  It’s also one of the tabs I have pinned open, in the form of Tweetdeck.
  • Lifehacker.com – Just because.  I have this site as a newsfeed in Google Reader, as a site I visit usually 2 or 3 times a day and as an email digest sent through a couple of times a week.  It’s excellent and I urge you to go there.  If you don’t find anything useful, at the bottom of the page there are the partner sites and I guarantee you’ll find something there.
Now head over to Kate Takes 5, which by rights should’ve been the 5th site on this list as there’s always something new and interesting there, and see where everyone else goes.