Drupal Update Handlers with increased memory_limit
on
Drupal Update Handlers with increased memory_limit
I'm doing a lot with update handlers these days. This is where I put almost all of the configuration changes for a release. Putting configuration changes in update handlers has the huge advantage of (a) source controlling these changes, and (b) allowing you to qa them. I strongly recommend this practice.
Most configuration changes are very easy to make in code. Often all you need to do is call variable_set. Sometimes, you have to write some SQL to directly change a table value.
The difficult changes usually involve CCK content types. A year and a half ago I wrote on Programmatically Create, Insert, and Update CCK Nodes. In Drupal 5.x it's not easy. (I hear it's easier in Drupal 6.x, but unfortunately, I have yet to do much 6.x work yet.) I've adopted the practice of doing all configuration changes except for CCK content type changes, in these update handlers... the CCK changes we've managed using the UI.
Up until this release... In the latest release, our client had a board meeting during the sprint, so we had to put all the CCK changes in the update handler too. There were lots of CCK changes, so we had to clear the cache multiple times during the update.
We discovered that clearing the CCK caches in the middle of your update handler uses a lot of memory, and in our case, broke our server limits.
And the tip you've been waiting for...
If you use update handlers, and if you clear the cache, the cache clear should always be the last thing you do. If you need to clear the cache multiple times, you should use multiple update handlers.
And the second tip...
Increase the php limits for just update.php by changing the memory_limit in your .htaccess:
<IfModule mod_php5.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
+ # Increase the memory limit for update.php
+ <FilesMatch "update.php$">
+ php_value memory_limit 512M
+ </FilesMatch>
</IfModule>
on cheap hosting accounts such intrusion to .htaccess ignored by global rules, so memory limit is a large problem even on 32M`s accounts
PS. Where is a spam in my message? 8(













Please help me. As a Drupal expert could you please help me, and explain why I am getting this <br /><br />ERROR MESSAGE<br /><br />??? user warning: Illegal mix of collations (utf8_general_ci,IMPLICIT) and <br /><br />(utf8_unicode_ci,IMPLICIT) for operation '=' query: SELECT s.uid, c.updated FROM <br /><br />ctools_object_cache c INNER JOIN sessions s ON c.sid = s.sid WHERE s.sid != <br /><br />'78344d7f605b1766dfdfaaf85c6d4cb8' AND c.obj = 'delegator_page' AND c.name = 'test_panel' ORDER <br /><br />BY c.updated ASC in <br /><br />/home/filmforf/public_html/sites/all/modules/ctools/includes/object-cache.inc on line 92.????<br /><br />The above is on my live production site. Please check it at www.filmforfree.org<br /><br />I also get the same error message when I try to access my Local Host Drupal website.<br />"" Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 793825 bytes) <br /><br />in C:\xampp\htdocs\drupal\includes\database.mysqli.inc on line 303<br /><br /><br />Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 914098 bytes) in <br /><br />C:\xampp\htdocs\drupal\includes\database.mysql-common.inc on line 41""<br /><br />Please Please help me.