How To fix the Drush error "exec() has been disabled for security reasons bootstrap.inc"

  • Posted on: 5 October 2015
  • By: Michael

I occasionally have to deal with shared hosting. Which I'll admit, I'm not real happy about as I generally have to install a bunch of my default tools, most of which then have to be 'fixed' to work on [insert cheap hosting firm's name]'s concept of security.

As I just did this (again), here is the 'patch' for drush to make it 'play nice.'

Summary Procedure

Copy php.ini to a drush usable location and edit for your problems.

Detailed Procedure

The Error:

# drush status
exec() has been disabled for security reasons bootstrap.inc:645      [warning]
exec() has been disabled for security reasons bootstrap.inc:645      [warning]
 PHP executable        :  /usr/bin/php-cli       
 PHP configuration     :  /usr/local/lib/php.ini 
 PHP OS                :  Linux                  
 Drush version         :  6.6.0                  
 Drush configuration   :                         
 Drush alias files     : 

Your first step is to identify where your existing php.ini is. Thankfully the drush status above tells you, "/usr/local/lib/php.ini".

Your next step depends on if you are on shared or dedicated hosting.

For Shared Hosting:

Copy your system php.ini to either $HOME/.drush or your actual drush directory.

For Dedicated Server:

Copy your system php.ini to /etc/drush/php.ini.

Then remove 'exec' from the 'disable_functions' list in the php.ini you've copied.

$ grep disable php.ini 
; This directive allows you to disable certain functions for security reasons.
disable_functions = show_source, system, shell_exec, passthru, popen, proc_open

Afterwards they should look like:

$ grep disable php.ini 
; This directive allows you to disable certain functions for security reasons.
disable_functions = show_source, system, shell_exec, passthru, popen, proc_open
 
$ drush status
 PHP executable        :  /usr/bin/php-cli                      
 PHP configuration     :  /etc/drush/php.ini /etc/drush/php.ini 
 PHP OS                :  Linux                                 
 Drush version         :  6.6.0                                 
 Drush configuration   :                                        
 Drush alias files     : 

# # #

All for today!

Michael

Footnotes:

As I want want all users on my servers to use the same drush php.ini, I place drush's php.ini in /etc/drush.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
You know what to do...
11 + 2 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.