hello
i had my site running up and running fine, but yesterday i accidently uploaded drupal 6 installation files into my module directory (i know pretty lame) ever since than i get the following message:- Fatal error: Call to undefined function user_access() in /home/xxx/public_html/modules/admin_menu/admin_menu/admin_menu.module on line 264
even if i delete the mentioned file or module the error just changes to some other module and or file. i do have a complete back up just of 2 days ago (database and all my site files). i tried reuploading my back up files but it still didn't work. should i delete all the files on my server first and then reupload? do i have to use my older database as well?
files on the server at root:
.cpanel
.htpasswds
access-logs (shortcut)
etc
mail
mail
public_ftp
public_html
tmp
www (shortcut, it leads to the public_html directory)
.contactemail
.lastlogin
page.tpl.php
style.css

please help me out. Thank You.

Comments

cog.rusty’s picture

First, make sure that you don't have any duplicate modules or backups anywhere under drupal.

Then go to your database with phpmyadmin, "system" table, and find the rows of the following five modules.

system.module
node.module
user.module
filter.module
block.module

For each one of them, make sure that
- its "status" is 1
- its "filename" is "modules/[module-name]/[module-name].module" and nothing else.

If you found any different paths for these five modules in the system table, take a note and search for those folders, in case there are duplicates.

Never put contributed modules in /modules. Always put them in /sites/all/modules and nowhere else.

Ralph Manis’s picture

THANK YOU!!!

toddwshaffer’s picture

I pulled an accidental sudo drush dl and hit enter without the module name I was going for. The site immediately broke due to Drupal core being downloaded into the sites/all/modules folder. When I copied/pasted the internal error from the command line this was the first Google result. Which made life a whooole lot easier.

I 'rm -rf' the core folder within the sites/all/modules folder. Then luckily I already had phpMyAdmin installed, which made it easy to find the five core modules that had been 're-pathed' in the system table. I renamed them to their original paths, then visited the /admin/build/modules and it reverted all of my damage.

Thanks!

fehin’s picture

cog.rusty, your filename tip really helped me. I had mistakenly uploaded drupal into the sites/modules folder and that changed the path in the database. The path in the database didn't change even after I deleted the drupal folder from sites/modules. Editing the paths in the filename column brought my site back to life. I was getting "Fatal error: Call to undefined function: user_access()" and white screen of death on the update.php page, so this is a big relief.

arminm’s picture

Hi,

I have a drupal 7 site on a hosted server. Just performed the update from 7.39 to 7.40, via filezilla, then got this message when trying to access the site
Fatal error: Call to undefined function user_access() in /home/.../modules/system/system.module on line 1966

Followed your recommendations from above using phpmyadmin and could not find any mistake, modules are in right place and have 1.

Double checked: modules were in right place in database but not on server. It seems Filezilla copied directories but not their content.

Using your advice with update.php and checking error messages I could get site back step by step adding missing modules and oder files.

Thus, solved.

Thanks
Armin

Desi Raaj’s picture

none of the rows you mentioned exists...trust me i looked very closely and i know a thing or two about databases.
but in my modules directory they all exists.

cog.rusty’s picture

Were you already using Drupal 6? Or was it Drupal 5 before this happened?

Look at these existing modules. Are they inside /modules/[module-name] directories? Do they have an .info file? Do these .info files contain version information?

Desi Raaj’s picture

i'm using drupal 6, actually i just started building my site about 2 weeks. Yes those modules that you mentioned are in /modules and they do have .info file. i was just thinking about importing my backup database as it does have those rows in the system table. i will report back after i've imported the database. also as you advised i will move all the contributed modules to sites/all/modules. thank you :)

cog.rusty’s picture

If the changed paths of the modules give you any trouble, the paths should be automatically updates when you visit the admin/build/modules page.

The 5 modules that I mentioned can't be moved. They will break.

Desi Raaj’s picture

I think that's what happened in the first place, since i accidently uploaded drupal installation files into my module directory it broke the path for the 5 modules that you mentioned. I still haven't imported my database yet....gotta finish some last minute hw lol... i was actually thinking instead of importing the whole database, i can just alter the system table to include the five modules. what do you think?

cog.rusty’s picture

Probably nothing else has changed, so it seems possible to import only that table. But I can't think of every possible consequence.

Desi Raaj’s picture

finally got it to work, i imported my backup database and it made the necessary changes to system table and i had to move a few things around. Thanks ALOT for all of your help :)

scotwith1t’s picture

Thanks for the fix, it definitely did the trick...

But seriously, let's take a step back...so is there nothing to be done about this? All I did was accidentally download core to the modules folder and my whole site's broken?!?! I typed drush dl -content_taxonomy (obviouslt the - was a type-o) and i have core dl'd to my modules folder. but THAT changes the path to every system module folder in my DB!!?? I don't get it.

cog.rusty’s picture

Probably this is a kind of a "feature" to allow rearranging and even overriding some modules.

I think it would be better if the paths of the 5 required core modules were hard-coded, since it won't work if you move them around anyway. The paths of all the other modules, either core or contributed, can be corrected automatically in the database by deleting the duplicate files and simply visiting the admin/build/modules page.

alexmoreno’s picture

i've had this problem running cron. Simply reparing the tables (if you don't know which one, execute under all with phpmyadmin) solved , aparently, the problem.

RmrJmrGrl’s picture

I have this problem and I have fixed all my filenames back to their correct location, removed all duplicate modules from the folders but my site is still getting this error. What else is there to look for?