Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I looked at lots of posts on this however I have a hosting provider that is willing to make changes but so far there has been no improvement.
>php -c ~/public_html/php.ini -i | grep memory
memory_limit => 128M => 128M
in .bash_profile:
alias drush='php -c ~/public_html/php.ini ~/drush/drush.php'
Output from CLI:
>drush st --debug
Found command: core-status (commandfile=core) [0.06 sec, 3.36 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.06 sec, [bootstrap]
3.38 MB]
Initialized Drupal 6.19 root directory at [notice]
/home/domain/public_html/drupal [0.07 sec, 4.18 MB]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.07 sec, [bootstrap]
4.19 MB]
Initialized Drupal site domain.com at sites/domain.com [0.19 sec, [notice]
4.41 MB]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.19[bootstrap]
sec, 4.41 MB]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.2 sec, [bootstrap]
4.42 MB]
Successfully connected to the Drupal database. [0.2 sec, 4.42 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.2 sec, 4.77[bootstrap]
MB]
session_start(): Cannot send session cookie - headers already sent by[warning]
(output started at /home/domain/drush/includes/drush.inc:820)
bootstrap.inc:1162 [0.2 sec, 4.86 MB]
session_start(): Cannot send session cache limiter - headers already [warning]
sent (output started at /home/domain/drush/includes/drush.inc:820)
bootstrap.inc:1162 [0.2 sec, 4.86 MB]
Cannot modify header information - headers already sent by (output [warning]
started at /home/domain/drush/includes/drush.inc:820)
bootstrap.inc:726 [0.21 sec, 5.23 MB]
Cannot modify header information - headers already sent by (output [warning]
started at /home/domain/drush/includes/drush.inc:820)
bootstrap.inc:727 [0.21 sec, 5.23 MB]
Cannot modify header information - headers already sent by (output [warning]
started at /home/domain/drush/includes/drush.inc:820)
bootstrap.inc:728 [0.21 sec, 5.23 MB]
Cannot modify header information - headers already sent by (output [warning]
started at /home/domain/drush/includes/drush.inc:820)
bootstrap.inc:729 [0.21 sec, 5.23 MB]
Fatal error: Out of memory (allocated 8126464) (tried to allocate 24576 bytes) in /home/domain/public_html/drupal/includes/common.inc on line 2711
Drush command could not be completed. [0.25 sec, 7.72 MB] [error]
It is their opinion that the problem is within Drupal or Drush and not their configuration.
Is anyone able to provide comments for the hosting provider? This Issue is being followed by their ticketing system.
Comments
Comment #1
greg.1.anderson CreditAttribution: greg.1.anderson commentedHm, hard to say. I would recommend upgrading to drush-4 (drush-4-rc3 is out, stable will be out soon). Then you can skip the alias and run the 'drush' script directly, and it will pick up whatever php.ini you have in your $HOME/.drush folder.
As for reproducing your problem, try drush first with all of your contrib modules disabled, and then turn them on one set at a time until you isolate your problem. In theory, if Drupal works with 128M in the web browser, then it should also work with 128M in the shell -- unless perhaps you are all out of memory, and php can't get its full 128M ("Fatal error: Out of memory (allocated 8126464)").
You know that you can also put drush + your dev site on your local machine, and use the isp just for your live site...
Comment #2
waverate CreditAttribution: waverate commentedGreg,
Thank you for the quick reply.
I just can't get past the fact that Drush is saying that it (allocated 8126464) and (tried to allocate 24576 bytes) when it failed. These numbers are not anywhere near a 128M limit unless I am not understanding what these numbers are representing.
I would think that either:
a. the hosting provider is not allowing php to get 8126464+24576 bytes of memory, or
b. Drush is incorrectly reporting the memory that it is trying to allocate.
Is it possible have one of the first lines of the debug return what Drush thinks it has for PHP memory?
Comment #3
waverate CreditAttribution: waverate commentedActually, this all started because I am trying to upgrade core by hand and I wanted a list of all the installed modules so that I could turn them off until after the upgrade.
It would have been so nice to:
So, I do find it ironic that to test why I cannot run
drush sm
, I need to turn the modules off by hand and then turn them on one at a time.But, hey, if you can't laugh at yourself ..
Comment #4
greg.1.anderson CreditAttribution: greg.1.anderson commentedYeah, it's too bad drush doesn't work. If sm did work, you could use
drush pm-list --status=enabled --pipe
rather than piping through grep.It's not drush that is reporting how much memory it tried to get; PHP reports that. Sometimes ISPs limit the amount of RAM you can use, so if the web server is using a lot, maybe there is none left for drush. If you don't need to keep your site up while you test, then maybe you should try stopping the webserver, and see if that gives you enough memory to use drush. You could also install drush on your local machine, then use drush rsync and drush sql-sync to copy your remote site over, and see if things work better locally.
Comment #5
waverate CreditAttribution: waverate commentedAh, at least MySQL didn't let me down:
To get a rough list of modules that were enabled:
Sorry, I don't know how to read the version number out of the field.
Comment #6
waverate CreditAttribution: waverate commentedGreg,
That's exactly what I'm trying to find out. How do you phrase that question to a hosting provider so that you don't get a automatic "we're not limiting RAM" response?
Comment #7
waverate CreditAttribution: waverate commentedOkay, so a little depressing:
The only modules enabled are:
And the output from CLI:
Comment #8
greg.1.anderson CreditAttribution: greg.1.anderson commentedAll I can say is try the same experiments on a local machine and see if you get better results. You can try running 'top' on your ISP to monitor memory. Log on with two terminals. n.b. 'top' takes a lot of memory too.
Comment #9
waverate CreditAttribution: waverate commentedOkay. I was troubleshooting the above posts on a dev multisite installation on my hosting provider's server. So I'm trying this on my own dev server (dev2) by grabbing:
A quick install with the same php.ini file and alias and
drush st
works well. I would hope so or else the Issues queue would be full.The next step is to grab my production environment as mentioned in #4.
I set up ~/.drush/website.aliases.drushrc.php
If I run
>drush @prod @dev
, I am getting:Is the path_alias on the @prod (remote) site paths on that machine or on my local machine?
Comment #10
waverate CreditAttribution: waverate commentedActually, on second thought, where does the password for the remote (@prod) site go?
Comment #11
greg.1.anderson CreditAttribution: greg.1.anderson commentedYou need to either a) set up a public/private key pair or b) do backflips. The latter is left as an exercise for the limber. :)
To set up your pub/priv key pair, I recommend using the "pushkey" command from drush extras:
That last one will try to run drush remotely on your ISP, and will therefore probably fail for you. However, you can use drush rsync and drush sql-sync without running drush remotely, so this will probably work:
You can leave off the --create-db if you create your database by hand first.
Comment #12
waverate CreditAttribution: waverate commentedGetting there.
As you expected
drush @prod status
did not work. The rsync worked well. When I try to run the sql-sync on the @dev (local) server, I get:Do I need to check my @prod alias?
Comment #13
greg.1.anderson CreditAttribution: greg.1.anderson commentedOh yeah, good point.
On your dev machine, run this command:
drush site-alias @dev --with-db --show-passwords
This will print out a longer site alias that includes a 'databases' record. Copy the databases record into your site alias for @prod, and edit it so that it is correct. If drush was working on your ISP, then you could have done the site-alias command on @prod directly. This is, in effect, what drush is doing in sql-sync when it sees that there is no 'databases' record in your site alias: it goes off and fetches the db info remotely, using drush. That's why you're seeing the error. If you add the databases record locally, then the sql-sync should work.
Comment #14
waverate CreditAttribution: waverate commentedI have to hand it to you; you are very patient (for now).
On the @dev server, the results from drush site-alias @dev --with-db --show-passwords is:
There is no database information.
Comment #15
greg.1.anderson CreditAttribution: greg.1.anderson commentedHm, you might want to upgrade to drush-HEAD. Failing that, you can just copy your $db_url from your settings.php file and put it into your @dev and @prod aliases. I see that you already did that, except you accidentally named them 'db_url' instead of 'db-url'. Change the underscore to a dash, and drush should be happy.
Comment #16
waverate CreditAttribution: waverate commentedI needed to clean up a couple of things first:
On the @dev server, after running: drush sql-sync @prod @dev --create-db --structure-tables-key=common
It looks like the @dev site is up and running. What could that last error be from?
Comment #17
greg.1.anderson CreditAttribution: greg.1.anderson commentedYou're getting there. You are running drush on the dev site as a different user than the webserver is, so when drush tries to write the database, it gets a permission denied error. add the flag
--db-su=privuser
and--db-su-pw=secretpassword
to supply the correct credentials to the dev machine.If you want to see more info about what drush is doing, you can try running the command first with -s or --simulate, which will show the commands that drush is going to run, and then run it again with -d (and without -s), which adds debug output to the execution.
Comment #18
waverate CreditAttribution: waverate commentedOkay. Using the -s switch showed the echo command that was the equivalent of the following commands individually with mysql -hlocalhost -u[db_username] -p[db_password]:
Then the database is imported with:
mysql -hlocalhost -u[db_username] -p[db_password] db_website --silent < /home/website/.drush/dump/dev.sql
Shouldn't there be a FLUSH PRIVILEGES; after the GRANT?
Using --db-su and --db-su-pw at the end of the drush sql-sync worked.
Comment #19
greg.1.anderson CreditAttribution: greg.1.anderson commentedYes, you are correct -- there should be a FLUSH PRIVILEGES after the grant. I opened #1001778: drush should flush privs when creating a mysql database. for that.
Glad you got your local site sync'ed over okay.
Comment #20
waverate CreditAttribution: waverate commentedTo summarize:
drush site-alias @dev --with-db --show-passwords
and add the 'databases' record to @proddrush dl drush_extras
and thendrush pushkey @prod
drush rsync @prod @dev --include-conf
to create the local sitedrush sql-sync @prod @dev --create-db --structure-tables-key=common --db-su=privuser and --db-su-pw=secretpassword
to copy the databasedrush cc all
I am not sure why
drush @dev cc all
did not work. It returned:Comment #21
waverate CreditAttribution: waverate commentedOops.