0 points, 3082 views
Solutuion to the "Call to undefined function file_scan_directory()" Drupal error

I encountered the "Call to undefined function file_scan_directory()" whilst trying to copy a drupal 6.x installation to my laptop. After much searching around on the fairly unhelpful Drupal support forums I found decided to dig around the Drupal databaes in more detail.

The solution (in my case) was pretty straight forward, I open the Drupal 'variables' table, found an entry called 'cache' and changed: s:1:"0"; to s:1:"2"; (from no caching to aggressive caching). Once done the site started working again. Afterwhich I changed the value back to s:1:"0"; (I don't want caching on a development site).

Oh, one other thing I did before this was to empty the 'cache' and 'cache_*' tables and also empty the 'sessions' table.

I picked up a few pointers from this Drupal article, but in typical Drupal style once the developer has figured out the problem and left their customary 'fix will be rolled out in the next beta' comment, further advice to actually fix the problem is often not given.

Anyay, I hope this is helpful for anybody else trying to simply duplicated a Drupal installation and please feel free to add comments to this post.

- UPDATE: Actually, I have discovered a better way around this problem. Before you export the orignal database, ensure that "Clean URL's" is switched off. Perform the database export, then you can enable them again. Also, as soon as you import the database to the new schema ensure that you empty all the cache tables - * do this before attempting to run Druapal* Hope this helps...