I have been trying to get Drush to work correctly on my Inmotion Hosting VPS for a few days now. I have spent some time in #drush and searching Google with some success. I have to start by saying that my PHP and web server knowledge is very limited. I'm guessing some people may ask why I am trying to use Drush since I'm certain it can be a dangerous thing to mess with (especially on a live server) if you don't know what you're doing. Well, I'm really just trying simple commands (such as 'drush status' or 'drush en color') to test if Drush is working. Once I know it is working, I plan to seek the knowledge necessary to really use it with Make to create some install profiles. That's where I'm headed.

First issue I had after installing Drush was out of memory errors. I could run 'drush status' from my home directory successfully, but once I entered any of my site folders (~/public_html/sitenamefolder) and ran 'drush status', I would get memory errors that lead me to believe that there was a CLI limit of about 32MB set on the server. I called Inmotion and had them turn Fork Bomb Protection off and the problems persisted.

So, after searching google, this is what I did:

created a custom ini file (called drushmem.ini) in my '~/www' folder with the follwing lines

max_execution_time=90;
max_input_time=180;
memory_limit=256M;

After doing this, I added this line to the .bashrc file:

alias drush='php -c ~/www/drushmem.ini ~/drush/drush.php -u 1'

This seemingly fixed my problems. I could now run 'drush status' without memory error.

So I moved onto trying to use 'drush en color' on a specific site and I was getting a new error

-bash-3.2$ drush -d en color
Bootstrap to phase 0. [0.01 sec, 3.37 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 3.57 MB] [bootstrap]
Loading drushrc "/home/unchar5/public_html/omegasandbox/sites/default/drushrc.php" into "site" scope.   [bootstrap]
[0.02 sec, 3.57 MB]
Cache HIT cid: 5.4-commandfiles-0-d579284f7aea7a2dcf08a28c3b6ace69 [0.03 sec, 3.58 MB]                      [debug]
Bootstrap to phase 0. [0.09 sec, 7.57 MB]                                                               [bootstrap]
Bootstrap to phase 6. [0.11 sec, 7.58 MB]                                                               [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.11 sec, 7.58 MB]                              [bootstrap]
Initialized Drupal 7.14 root directory at /home/unchar5/public_html/omegasandbox [0.16 sec, 10.38 MB]      [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.16 sec, 10.38 MB]                             [bootstrap]
Initialized Drupal site default at sites/default [0.16 sec, 10.38 MB]                                      [notice]
Cache HIT cid: 5.4-commandfiles-2-c32acd775c18a90c5b41d0fc9accf5ab [0.17 sec, 10.39 MB]                     [debug]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.17 sec, 10.42 MB]                    [bootstrap]
PDO support is required. [0.18 sec, 10.43 MB]                                                           [bootstrap]
Bootstrap to phase 5. [0.18 sec, 10.44 MB]                                                              [bootstrap]
Command pm-enable needs a higher bootstrap level to run - you will need invoke drush from a more        [error]
functional Drupal environment to run this command. [0.18 sec, 10.44 MB]
The drush command 'en color' could not be executed. [0.18 sec, 10.44 MB]                                [error]
Drush was not able to start (bootstrap) the Drupal database.                                            [error]
Hint: This error often occurs when Drush is trying to bootstrap a site that has not been installed or
does not have a configured database.

Drush was attempting to connect to :
  Drupal version    : 7.14
  Site URI          : http://default
  Database driver   : mysql
  Database hostname : localhost
  Database username : REMOVED
  Database name     : REMOVED
  Default theme     : garland
  Administration theme: garland
  PHP configuration : /home/unchar5/public_html/drushmem.ini
  Drush version     : 5.4
  Drush configuration:
  Drupal root       : /home/unchar5/public_html/omegasandbox
  Site path         : sites/default
  Modules path      : sites/all/modules
  Themes path       : sites/all/themes
  File directory path: sites/default/files
  %paths            : Array

You can select another site with a working database setup by specifying the URI to use with the --uri
parameter on the command line or $options['uri'] in your drushrc.php file.
 [0.18 sec, 10.44 MB]

From above, I noticed this line in particular:

PDO support is required. [0.18 sec, 10.43 MB] [bootstrap]

After some researching I found that I should add some lines to the drushmem.ini php file to call the correct PDO extensions. So I added:

extension=pdo.so;
extension=pdo_mysql.so;

OK, finally!.. so I thought.

-bash-3.2$ drush -d enable color
Bootstrap to phase 0. [0.01 sec, 3.37 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 3.57 MB] [bootstrap]
Loading drushrc "/home/unchar5/public_html/omegasandbox/sites/default/drushrc.php" into "site" scope.   [bootstrap]
[0.04 sec, 3.57 MB]
Cache HIT cid: 5.4-commandfiles-0-d579284f7aea7a2dcf08a28c3b6ace69 [0.05 sec, 3.58 MB]                      [debug]
Bootstrap to phase 0. [0.1 sec, 7.57 MB]                                                                [bootstrap]
Bootstrap to phase 5. [0.12 sec, 7.57 MB]                                                               [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.12 sec, 7.57 MB]                              [bootstrap]
Initialized Drupal 7.14 root directory at /home/unchar5/public_html/omegasandbox [0.16 sec, 10.37 MB]      [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.16 sec, 10.38 MB]                             [bootstrap]
Initialized Drupal site default at sites/default [0.16 sec, 10.38 MB]                                      [notice]
Cache HIT cid: 5.4-commandfiles-2-c32acd775c18a90c5b41d0fc9accf5ab [0.17 sec, 10.38 MB]                     [debug]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.17 sec, 10.42 MB]                    [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.17 sec, 10.43 MB]                         [bootstrap]
Successfully connected to the Drupal database. [0.18 sec, 10.43 MB]                                     [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.19 sec, 11.12 MB]                             [bootstrap]
Drush command terminated abnormally due to an unrecoverable error.                                      [error]
Error: Out of memory (allocated 41156608) (tried to allocate 71 bytes) in
/home/unchar5/public_html/omegasandbox/includes/theme.inc, line 1144 [0.5 sec, 39.24 MB]

Fatal error: Out of memory (allocated 41156608) (tried to allocate 71 bytes) in /home/unchar5/public_html/omegasandbox/includes/theme.inc on line 1144

Now I'm running into memory errors again. However, if I moved to another site, 'drush en color' works. Once I disabled enough modules on the site I was previously trying to run 'drush en color' on, it would work there as well.

So, I think the memory error was solved, but when adding the PDO extension lines, it's almost as if the memory_limit is being ignored again.

Here is how each file is configured at the moment:

drushmem.ini

max_execution_time=90;
max_input_time=180;
memory_limit=512M;

extension=pdo.so;
extension=pdo_mysql.so;

.bashrc

export PATH="$PATH:/home/unchar5/drush:/usr/local/bin"
alias drush='php -c ~/www/drushmem.ini ~/drush/drush.php -u 1'

I'm hoping someone can point me in the right direction. As I said, a lot of this stuff is new to me and I'm afraid I may just have something misconfigured.

On a side not, .bashrc doesn't appear to be the correct file to use on Inmotion, as it does not get automatically read in when I log out/back in. However, I am loading it via 'source .bashrc' any time I log out or make a change to the file.

I would appreciate any help/troubleshooting tips! I'll be happy to provide any additional info you may need to help.

Thank you!
Kirk

Comments

modctek’s picture

I don't think you need to use the semicolons at the end of each line in your ini file. I was having a similar problem and used the above sans semi-colons and was able to get it to work.

greg.1.anderson’s picture

Status: Active » Closed (fixed)

Presuming fixed by #1.

cfischer50’s picture

Thank you for this post! It solved my problem with the "PDO support is required" message that halted the bootstrapping process and prevented the php-cli connection to the database at this point:

...
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.11[bootstrap] sec, 6.4 MB]
PDO support is required. [0.11 sec, 6.4 MB]
... 

I added this to my drush.ini:

extension=pdo.so
extension=pdo_mysql.so

And FINALLY it worked! I've spent DAYS bugging those poor techs at my hosting service!