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.
By Juc1 on
Hi all,
admin/reports/status and phpinfo.php tell me that my PHP memory limit is 256M but when using Drush I m getting memory error messages re 64M eg
Fatal error: Out of memory (allocated 69468160) (tried to allocate 122880 bytes) in /home...
Any suggestions please?
Thank you
Comments
I think this will help you
I think this will help you out
http://drupal.org/node/457416
@ undersound3 Thanks for that
@ undersound3
Thanks for that link. I mentioned the link to my (shared hosting) host (see below).
Can I just please check - is it possible for Drupal to fix or over-ride the PHP memory limit (I think not)?
Thanks
On Sat, Jul 14, 2012 at 1:26 PM,
From support@.....host.com
To ...@gmail.com
Hi
Like I said, the system PHP memory limit is already set to 256MB. This is
being overridden somewhere within your code or the code that you're running.
You can see the system PHP variables by running 'php -i' from the command
line or by executing phpinfo().
Kind regards,
On Sat, Jul 14, 2012 at 1:22 PM
From ...@gmail.com
To support@.....host.com
Can you please check the the file /etc/php5/cli/php.ini as mentioned
in the link below.
Thank you,
http://drupal.org/node/457416 =
modify the file /etc/php5/cli/php.ini
search for "memory_limit" and change it from the default of 32M to
something larger...
It's not just php.ini that counts. PHP config settings can be set in
multiple places. Settings on the same server may or may not take
effect or not depending on the calling user, script location, PHP
version and binary (CLI, CGI, apache module etc) involved. Testing php
--info may not show you the relevant values because it may not load
settings specific to your Drupal site....
Several of the above comments seem to be having specific issues with
Drush on shared hosting environments or CPanel / WHM / etc setups.
Please consult your hosting documentation if you are having similar
issues, and if you are experiencing resource limits specific to Drush,
when requesting support from your hosting company make sure to alert
them to the fact that you are running PHP from CLI.
Have you created a drush.ini
Have you created a drush.ini with the memory limit in the root of your Drush folder? Drush doesn't use the php memory limit. You can edit the file drush/examples/examples.drush.ini, change the memory limit, and save it as drush/drush.ini. You won't be able to override your host's 256mb though, that will be the maximum if you are on shared hosting.
@ Jaypan thanks for your help
@ Jaypan thanks for your help - no I haven't created a drush.ini file. But before I do that is there any command that will display the current memory limit that Drush is using?
Thanks
Maybe.
Maybe.
more memory problems =
more memory problems = http://drupal.org/node/1289956
So which path is shown under
So which path is shown under PHP configuration when you run the command drush status
# drush statusPHP
I added the second file myself but it doesn't seem to help.
Thanks
And which location for
And which location for php.ini is shown in phpinfo.php?
Loaded Configuration
Loaded Configuration File /usr/local/lib/php.ini
screenshots = http://jusand.co.uk/drush
Thanks
Sorry but then I don't know
Sorry but then I don't know what's causing this.
Perhaps someone in the drush issues section can help you better.
Drush installed successfully on shared hosting
In my case I tried to install Drush 5.x-dev (dated August 7, 2012) on a ukrainian shared hosting Hvosting.ua
I have a user-level SSH access to the server.
I started with downloading and unpacking:
After running
# php ~/drush/drush.php status
in the drupal directory I got memory limit error:So, the limit on my php.ini was 32 Mb only:
Didn't believe it, because i clearly remember setting memory_limit to maximum allowed 256 Mb through ISP Manager.
But then I noticed, that my home-folder contains a
php-bin
directory.Inside I found the launch script for php5-cgi and the php.ini, created with ISP Manager, containing my manually set 256 Mb memory_limit.
I was in luck, because php5-cgi had 128 Mb limit by default and 256 Mb limit with my settings:
Well, html output was unexpected, but I got me a php version I could work with.
So I added this to my ~/.bashrc alias section:
alias drush="/usr/bin/php5-cgi -q ~/drush/drush.php"
The battle wasn't over - drush was working correctly, but still showing some warnings (screenshot 1):
First of all, the wrong constant declaration STDERR should just be surrounded with '...' :
vi ~/drush/includes/drush.inc
So I added single quotes on line 1598 like this:
drush_print($message, 0, 'STDERR');
and that first notice went away.For the second warning I had to replace advanced output with more simple alternative:
vi ~/drush/includes/output.inc
It seems that php5-cgi knows nothing about $handle.
Replace the block from line 34 to line 38:
into just this single line:
print $msg;
And now drush became nice and helpful as always, even on my shared hosting (screenshot 2).
What we know shapes who we are.
In conclusion
Somewhere after first discovering memory_limit on standard php I tried to hack my way through it by defining new memory limit for drush.
I copied the example drushrc config into the working directory:
# cp ~/drush/examples/example.drushrc.php into ~/.drush/drushrc.php
And added at the very bottom of drushrc.php file:
ini_set('memory_limit','256M');
But that was construed by suhosin as an attack and hence - rejected:
So I went looking for a legit bypass through php5-cgi.
php5 -i |grep memory_limit
php5-cli -i |grep memory_limit
php5-cgi -i |grep memory_limit
If you are lucky - one of them will have higher memory_limit setting, that will allow you to use Drush and enjoy Drupal even more!
What we know shapes who we are.