0

I am getting this error on a Drupal 7 site on Ubuntu 12.10. I downgraded PHP from 5.4 to 5.3, but am still getting it.

Does anyone recognize this error?

Fatal error: Call to undefined function lock_initialize() in /home/buck/drupal/cms/includes/bootstrap.inc on line 2366

  • Make sure there's a file called includes/lock.inc in your Drupal installation, that it's the correct (un-hacked) version of the file, and that your web server can read it :) – Clive Nov 19 '12 at 18:09
  • Yes, got it. -rwxrwxr-x 1 buck buck 0 Aug 29 09:46 lock.inc – EdgeCase Nov 19 '12 at 18:13
  • It is running as www-data, and I just added buck to that group, and restarted the server, and still got the error. sudo usermod -a -G www-data buck – EdgeCase Nov 19 '12 at 18:24
  • The file permissions would make it readable to world anyway so that wasn't it, I removed that comment. There are some rumblings that it might be APC related, are you able to disable APC temporarily to test that? – Clive Nov 19 '12 at 18:27
  • I don't think I am using it. I don't see any references to it under /etc/php5 – EdgeCase Nov 19 '12 at 18:31
1

The function is called using code similar to the following, from Drupal.

  // Initialize the lock system.
  require_once DRUPAL_ROOT . '/' . variable_get('lock_inc', 'includes/lock.inc');
  lock_initialize();

_drupal_bootstrap_variables() is the only Drupal function that calls lock_initialize().

That code could fail if the file whose name is contained in lock_inc doesn't exist, but in that case I would expect another warning/error message, or it doesn't contain a function called lock_initialize().

I would check if there is code that sets $conf['lock_inc'], and which value is used. I would also check if there is code calling variable_set('lock_inc', ...).

0

I ran into this problem too. It occurred when I mysqldump'd my drupal db from my local dev machine and dumped it into my production db. I believe one of the cache tables had an entry that was referencing a file path that doesn't exist on my production server.

My fix: truncate all cache tables

I also restarted apache after that, but restarting apache was likely unnecessary. If you're running on linux, here's an easy command to truncate all your cache tables:

echo "show tables" | mysql yourdb | fgrep cache | xargs -I {} echo "truncate {};" | mysql yourdb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.