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.
Got this error in update.php while running the update from 1.1 to 1.2 (web based update, no drush update):
Warning: require(sites/all/modules/insert/includes/file.inc): failed to open stream: No such file or directory in require() (Line 10 von sites/all/modules/insert/insert.module).
Status message U
Why is the module not using the variable DRUPAL_ROOT
? Can this solve the bug?
require_once(DRUPAL_ROOT . '/' . drupal_get_path('module', 'insert') . '/includes/file.inc');
Comments
Comment #1
hass CreditAttribution: hass commentedNote, the file is there in the filesystem. Maybe a core update module timing/ordering issue with extraction.
Comment #2
quicksketchI've seen this behavior in the past due to APC's buggy include_once_override option. For a short while there some distros had this option enabled by default, causing general havoc around the PHP world as it repeated broke sites.
Restarting your web server (or PHP instances if running as fcgi) will usually clear up these problems after a code change.
Comment #3
hass CreditAttribution: hass commentedI have no APC, but FCGI on this server. I cannot restart PHP as this is a shared host. I guess if I have installed manually I would not have seen this. I'm not sure if there is any problem now or the upgrade had troubles and may broke something. I never seen this before with any other module I've upgraded!? What's the reason? Looks like a one time situation. At least it's not permanent now. It's latest Debian 6 server...
Comment #4
quicksketchSo did you get the problem resolved by some other means, like downloading and re-installing the module manually? I don't think Insert module is at fault here, it very well may be a fault on PHP's side (they've got bugs too). Obviously the file exists and at least it's working for me. That line was completely unchanged between versions, as were the file locations.
Comment #5
hass CreditAttribution: hass commentedThe update hooks completed and above the update result the drupal error message was shown. There was no outage. I'm myself not sure if the source may be the DRUPAL_ROOT or better an FCGI incompatibility with
require dirname(__FILE__)
. Aside shouldn't thisrequire_once
? http://api.drupal.org/api/drupal/includes!bootstrap.inc/function/drupal_... is not using__FILE__
. Just guessing if this is the source of this issue.Cannot be wrong to use (the Drupal way)... :-)
Comment #6
quicksketchYeah, it's a good idea nonetheless. dirname(__FILE__) probably requires disk access, or at least processing. DRUPAL_ROOT would certainly be superior. dirname(__FILE__) is left over from Drupal 6 when we didn't have DRUPAL_ROOT.
Oh... there's also was a problem in Drupal 6 where drupal_get_path() required use of the DB, thus causing installation profiles to fail... I'm guessing this is probably fixed in D7 too. May require a little testing.
Comment #7
hass CreditAttribution: hass commentedIs
module_load_include();
better?Comment #8
quicksketchmodule_load_include() calls drupal_get_path(), which is the source of the problem I believe (in Drupal 6). Both are probably okay in D7 but I haven't investigated.
Comment #10
Snater CreditAttribution: Snater commentedSwitched to DRUPAL_ROOT as that seems to be the more common practice.
Comment #11
Snater CreditAttribution: Snater commented