Continued from http://drupal.org/node/176003, http://drupal.org/node/343444.

We're getting this error with a custom install profile on Drupal 6.10 (and previous versions).

This is with a profile installing 34 Contrib and 14 Core modules. Now, this profile does install without error on a local environment. On our server environment some other factors are increasing the file_scan_directory() execution time.

CommentFileSizeAuthor
#1 install.inc_.patch376 bytesmoritzz

Comments

moritzz’s picture

Version: 6.10 » 6.12
Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new376 bytes

Read the update below!

Okay, because my provider allows to set the maximum execution (i.e. he's not running in safe mode), I just ported the simple patch from rszrama to 6.12. I know, it's a sort of a hack, because the underpinnings should be fixed. But it might help some others in the meantime.

moritzz’s picture

Priority: Critical » Normal

Important Update:

You can solve this issue without patching the core by just adding...

  // Increment the maximum execution time for PHP
  
  if ((int)ini_get('max_execution_time') < 240) {
    set_time_limit(240);
  }
  
  // Make sure the MySQL does not die while scripts are executed
  
  if (function_exists('db_query')) {
    db_query('SET SESSION wait_timeout = 240');
  }

... to the very beginning of your custom profile_modules function.

Remember though:This only works if your provider allows you to increment the maximum execution time for, i.e. PHP not running in sage mode, and to set the timeout of the MySQL Server.

mfabri’s picture

Omo, can you be more specific where to add this code.
Where is the profile_modules function (I'm new)?

Thanks.

moritzz’s picture

@mfabri You need to add a custom profile_modules hook in your custom ".profile" file. Let's say, your profile is called "foobar": Then you need to add this code to your custom foobar_profile_modules function at "/profiles/foobar/foobar.profile". (I'm not sure though, if writing custom profiles is something for newbies...)

thedavidmeister’s picture

Status: Needs review » Closed (won't fix)

The patch in #1 is not ok for a core patch. Configuring php needs to be done by whoever is responsible for making sure the server environment is ready for Drupal.

Either update your php.ini file, your .htaccess file or edit your settings.php file with ini_set() temporarily until your installer has completed then set it back to what it was OR install the site locally and deploy the database to your remote server once installation is complete.

Even if the patch was a good idea (which it isn't), it has whitespace issues and spelling and punctuation mistakes in the comment.