AN Hosting recently relocated to a Seattle datacenter. As part of this process, my site is now running on a much more modern server (AMD Opteron 6100-series Magny Cours vs. Intel Xeon 5400-series Harpertown).
Unfortunately, a new server and new install can mean software changes. AN Hosting has tightened up the security settings on PHP. Better security is always a good thing, but it means the Drupal command line utility drush no longer works out of the box. (For those that don’t know drush – please give it a chance. It provides near foolproof Drupal core/module/theme upgrades as well as command-line control of your Drupal sites.)
This was the error I received when running
The following restricted PHP modes have non-empty values: [error]
disable_functions. This configuration is incompatible with drush.
Please check your configuration settings in /usr/local/lib/php.ini or
in your drush.ini file; see examples/example.drush.ini for details.
The fix is easy – you simply have to give drush its own
php.ini file with looser security. The benefit here is that the Apache web server will run PHP in a more locked-down mode, but drush will operate with full permissions. SSH into your server and run the following commands:
mkdir -p ~/.drush cp -i /usr/local/lib/php.ini ~/.drush/
Note that if there is already a
php.ini file in
.drush/ it would be safer not to overwrite it (but hopefully you know what you’re doing if that file already exists). Leave the file as-is and modify the line below.
Edit the text file
~/.drush/php.ini and make sure the line with
disable_functions is empty:
That’s it! You can run
drush status to make sure everything is working properly. If drush reports additional errors, you may need to make further changes to the
These instructions aren’t strictly limited to the AN Hosting servers. This should work on any host which provides shell access (required to use drush). Much of this flexibility is not limited to drush – PHP has long been configured to use separate php.ini files for the shell and the web server. This allows logged-in users to have greater permissions than the public-facing web server. Take a look at the drush README for additional tricks, such as passing command-line parameters to PHP and running different versions of PHP than the web server uses.