(quick draft, will tidy up later)
Let’s assume you have the latest Acquia Dev Desktop, which comes with various PHP versions including 7.1, and you want to install the PHP memcached extension so you can use Drupal’s memcache module to make your local development a bit faster (and test for any memcached issues on production). But first…
Why still use Dev Desktop in 2018? Running PHP and MySQL directly is blisteringly fast compared to Docker for Mac – usually several seconds every page load, and with ADD you can instantly PHP restarts when changing a config setting (e.g. enabling/disabling Xdebug) compared to having to wait a minute or more for a Lando container to rebuild (Docker containers are immutable; you have to rebuild the container to make a significant PHP.ini change like adding or removing an extension – you can’t just restart the service). Composer is faster (still a bit annoying, of course, but consider what it’s doing in the background). Drush is faster, including rebuilding the cache. Over a day, every day, this all really adds up. For those of you using laptops, your battery life will be extended too. (Docker can also use quite a bit of CPU when idle).
Running PHP on the host means you’re directly accessing the file system and not having to jump through all the hoops you do with Docker and Vagrant – either slow file accesses, or having to wait for changes to sync. This is especially true with Drupal given all the caching it does.
It’s very unpopular to criticise Docker (which I’m not, exactly – more the hype and the rush to use it on a platform it wasn’t designed for, despite the slowness issues many people experience.) There’s a trade off between performance and configuration – the assumption seems to be you should go for whatever requires the least configuration, but is it really that hard to install the correct version of PHP or MySQL version (how about making a note of what your site runs in your Git repository?) I’d rather spend a bit longer up front getting the configuration right and have the performance benefit each day after. Also, if I have a choice of what to learn, I think knowledge of PHP extensions and configuration – given I’m a PHP developer – is more useful than learning loads about containers.
Comments welcome by email. (I use Ansible heavily, by the way, so I’m not opposed to automation.)
extract the tar file into its own directory (
This next line is the important bit – to make it properly compatible with the PHP version DevDesktop is using. Without this you may get an error like:
Symbol not found: _compiler_globals
Expected in: flat namespace
Tip: modules that don’t successfully load don’t show up in phpinfo(), so a quick way to see what the error was when PHP attempted to load them is to do
php -v (it’ll show any warnings above the version info) or
php -m to get a list of all the extensions loaded and verify yours is OK.
make make install
Important: if you need to rerun any of these steps, wipe the directory you extracted first and start afresh.
You should see:
Installing shared extensions: /Applications/DevDesktop/php7_1/ext/
There will now be a memcached.so file in that directory. If it hadn’t picked the config details up, it would have written to a different directory, e.g. your default homebrew one.
Add the memcached.so file to your php.ini – you can verify where that is via Preferences > Config in DevDesktop, but it would normally be:
You can save a backup for when you upgrade DevDesktop and it gets overwritten, but if the PHP version has changed you should compile it again.
NB: I rather thought PECL had an equivalent install command line switch to load the correct php-config, so you could just run pecl install command to save time, but apparently not? Let me know if I’m wrong.
Useful reading elsewhere: