When I go to my Drupal site index.php page, I get this error: "Fatal error: Call to undefined function: user_access() in ???\???\???\???\???\???\common.inc on line 1921". How can I fix this?

Comments

svejk’s picture

i have the same problem....

Dublin Drupaller’s picture

just downloaded and installed the latest version as a test site and got the same error.

UPDATE: Tried it on a different server...worked fine..

Dub

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate

andremolnar’s picture

I've done an install on a client's hosting server and am getting all sorts of errors which include the:

"Fatal error: Call to undefined function: user_access() in ???\???\???\???\???\???\common.inc on line 1921"

Which from everything I understand seems to indicate that the user.module is not getting loaded properly (and the other errors I am experiencing also indicate that code just isn't getting loaded when it should).

I have installed drupal hundreds of times - and on other hosts and my own, I never run into any issues. This leads me to believe that there are certain server configurations that will cause drupal to not load files correctly. I have checked all the permissions - and infact have maxed out the permissions on all of the files in all Drupal directories (just to make sure that wasn't the problem).

At any rate, I'll let you all know if I find a solution or a root cause.

andre

Heine’s picture

The website of our group stopped functioning around 7th of August with this exact error message.

I believe this is due to some excessive updating by the hosting company; they changed to Apache 2 (so my .htaccess file had to be fixed). And an empty phplist folder was suddenly in /modules.

Fixed everything, but to no avail.

The last straw I'm grasping; the PHP version is 4.3.11 whereas the Zend optimizer is just 1.3.0 - this combination seems to result in weird behavior of the foreach loops enumerating the modules. Probably no modules are included; so user_access won't be defined.

Php 4.3.10 (and up) should have Zend Optimizer 2.5.7. I just mailed the hosting company asking them if they updated, knew about Zend etc. but considering their normal reply speed, this might take a week or so...

This means I won't be sure this is the cause. Could you guys/girls check if you also have an incompatible PHP & Zend combination?

Greets,

Heine

PS if you don't know how to check, past the following into a file e.g. 'info.php' and upload it to your server. Then use your favorite browser to go to http://example.com/info.php

info.php:

<?php
    phpinfo
();
?>
Heine’s picture

Well,

The site works again. Although I haven't got a reply from the hosting company yet, with phpinfo() I saw that IONCube is no longer enabled. Zend v1.3.0 is still enabled.

So perhaps IONCube was the problem!

I'll let you know more once I hear something from the hosting company.

From the Agileco.com forum. :

"The problem was that the var assigned to hold the object in the foreach loop was being returned as an array...all the time."

UPDATE: I got a very informative reply from the hostingcompany stating they 'had some problems with the server'

lasker’s picture

Using the original modules/ and themes/ directories solved it for me, as I was trying to use only third party stuff for those and had totally replaced them.

Not that I have really researched why this happens, although I suppose user_access() must have been defined in a native drupal module which I had deleted.

klange’s picture

I resolved a user_access error by disabling ZendOptimizer.

-Kris

Matthew Doucette’s picture

How do you disable ZendOptimizer?

__________
Matthew Doucette / Xona.com

--
Matthew Doucette, Xona Games

peter_n’s picture

For the record I had this problem and found that when I extracted the drupal files for some reason (perhaps a timeout on the server) the last couple of modules weren't present. So drupal sort of ran, but got stuck on this one.

Worth checking just in case this has happened to you.

----------------------------------
neish.net | botanicalartistry.com

----------------------------------
neish.net | botanicalartistry.com

AliaK’s picture

yes I had the same problem also.

was strange. I was uploading a copy of my main site to my backup site (same hosting company but different server) prior to doing a drupal 4.6.3 upgrade to 4.7. previously the backup site had a working version of 4.7.3 which I had backed up and removed. after copy the 4.6.3 files and restoring it's db onto the backup site, the error was displayed.

I reuploaded the modules directory and original htacess file and it's ok now. so probably was a dodgy file upload during the initial copy.

whew!

thanks for the tips though! great to find some info to point me in the right direction quickly

thorprichard’s picture

FWIW... We found that this was happening when the system table in the drupal database had a bad path for some of the modules. The modules existed in the correct spot, but the table referred to an incorrect path. Once we manually edited the table, everything returned to normal. YMMV.

brendanc’s picture

After doing a database restore, this is what fixed my problem.

I believe drupal made a database cache containing the path to a folder I had accidentally left inside the modules directory and it was causing this error.

I don't know what table this was in specifically, but restoring from a recent backup fixed my problem. No amount of file manipulation would fix the problem.

mjlF95’s picture

This was the same problem I had, but I fixed it with the system table fix from a few comments down. Basically I'd uploaded a module directory in which I'd forgotten that I placed a whole bunch of other stuff I was working on at the time. I tried reimporting the whole database but it was too big and gave me an error, so I just exported the system table from the development site (I was working in the staging site) and imported it to the staging site. That got me to a point where the site at least worked. Then I just did a normal database restore using backup and migrate. Thanks!

yuREKLI’s picture

I have same problem but i don't know how i can edit to this table? What is the "system table in the drupal database"..

moreaus’s picture

PHP is usually right when it says "undefined function". For me the function was indeed not defined.
The core user.module was not loaded. It had been kicked from the system table.
(by creating a contrib user.module for another purpose myself)

I copied the user.module line back into the system table. Worked.

If you don't know, how to do that: Start by having a look at your database with PHPMyAdmin. It's simple.

calbasi’s picture

I've had the same problem.

In my case, it began when I did upload the Catalan translated files... That changed my directories permision to drwxrw-rw- and, of course, drupal can not access to these directories (right permisions are 755 - drwxr-xr-x).

Regards

www.calbasi.net
Ps: If you can not understand me, it's my poor English skills fault :-p

silvanasono’s picture

I had the same problem when I have updated my local version of my site with the version of repository.
After reading your replies, I have realized that the problem could come from the system table misaligned with the correct link structure of site.
So I have just replaced the db system table of my local with the one of the db of the development site and it worked.

ryosaeba’s picture

I've same error for my drupal website... but in a admin_module

Fatal error: Call to undefined function user_access() in /Applications/MAMP/htdocs/walterfantauzzi/modules/admin_menu/admin_menu.module on line 69

What I can do?

freestylegary’s picture

I had the same issue on a drupal 6 installation:
1. Open the System table in the database
2. Look for the entry 'modules/user/user.module' under the 'filename' column
3. If the value for 'status' is 0, change it to 1.
4. Save and you should be good to go.

bill3cr’s picture

Thanks that worked for me!

sharifudinrizal’s picture

You just saved my life! Thanks!

Any idea why this happened in the first place?

freestylegary’s picture

You're welcome.

I seem to recall something to do with deleting a module dependent on the user module (i don't remember which) without disabling it.

ddbell’s picture

I just installed the fastpath_fscache and I am getting the same error. I checked the status field and it is set to "1" already. Is there something else you could recommend for me to do.

The installation of the fastpath_fscache module had increased the performance of my site tremendously. Please do not tell me to uninstall it.

Thanks.

ddbell’s picture

This is my error message:
Call to undefined function user_access() in /home/btrubel0/public_html/mystorypad.com/includes/menu.inc on line 449

It only happens sometimes when clicking some of the view links on my home page.

Thanks for your help in advance.

freestylegary’s picture

What I can tell you is, you get an 'undefined function' error when PHP is unable to 'include' the file containing the called function...in this case 'user_access()'. Now, this function is contained in user.module, hence the first thing you should check is if the user module is enabled. If it is enabled, you would need to check if there is something else that is causing the user module to not load.

Hope this helps you.

bentedder’s picture

This worked perfectly. Thanks.

cristian2212’s picture

I set my database system I set the table and the state is one but it keeps coming Call to undefined function user_access () in Drupal 7

I need help please this is the link
http://www.grupocolorvision.com/

ryanc’s picture

I had this issue when the installation process was interrupted by a broken settings.php file. I cleared the database and ran the installation again and it resolved the issue.

IECODING.COM - Diseño Web Leon Guanajuato’s picture

i add

ini_set("memory_limit","32M");

@ sites/default/settings.php and works!

_ _
iecoding.com

pravin4u8288’s picture

I have same problem so Please anyone help me.
Fatal error: Call to undefined function user_access()

tech-o-matic’s picture

check the system-table. There has to be an entry for user.module:
- The status must be "1".
- Also check the path in "filename" !

I updated the core and this path changed (on my system).

jggarley’s picture

PLEASE HELP. I mistakenly copied a wrong folder into the sites/all/module folder and I'm getting this error. I deleted the wrong folder from there. My site is on a localhost and I did not have a backup and have put lot work into it that I don't want to lose them. I went to the system and did see the all entries for that wrong folder. I deleted them all, check the user.module status it was set to 1. I set to 0 and then back to 1 but still nothing happen. All i get is the below error message: Fatal error: Call to undefined function user_access() in C:\xampp\htdocs\zeinway\sites\all\modules\admin\admin.module on line 11

Please help me.

dalinian’s picture

Manually truncating the cache and sessions tables in the D7 database, then running drush cc all solved the problem for me.

Gik000’s picture

A double problem to me:

1) CACHE
2) FILE PERMISSIONS

1) THE CACHE
I did the same executing this sql script.

Truncate table myprefix_cache;
Truncate table myprefix_cache_admin_menu;
Truncate table myprefix_cache_block;
Truncate table myprefix_cache_bootstrap;
Truncate table myprefix_cache_eck;
Truncate table myprefix_cache_entity_comment;
Truncate table myprefix_cache_entity_file;
Truncate table myprefix_cache_entity_node;
Truncate table myprefix_cache_entity_taxonomy_term;
Truncate table myprefix_cache_entity_taxonomy_vocabulary;
Truncate table myprefix_cache_entity_user;
Truncate table myprefix_cache_field;
Truncate table myprefix_cache_filter;
Truncate table myprefix_cache_form;
Truncate table myprefix_cache_image;
Truncate table myprefix_cache_l10n_update;
Truncate table myprefix_cache_libraries;
Truncate table myprefix_cache_menu;
Truncate table myprefix_cache_metatag;
Truncate table myprefix_cache_page;
Truncate table myprefix_cache_path;
Truncate table myprefix_cache_token;
Truncate table myprefix_cache_update;
Truncate table myprefix_cache_variable;
Truncate table myprefix_cache_views;
Truncate table myprefix_cache_views_data;
Truncate table myprefix_sessions;

2) PERMISSIONS

I also needed to amend permissions on almost every place of my filesystem

Un moscerino nel web

I love PhpStorm

Computer Science is no more about computers than astronomy is about telescopes. Dijkstra

coscap-na’s picture

Hi, all.
I just updated the drupal core from 7.22 to 7.24, and now I am getting this message below when I try to access my site. I am running it on localhost right now. How do I fix this?

Fatal error: Call to undefined function ctools_include() in C:\Users\COSCAP\Sites\acquia-drupal\sites\all\modules\context\context.module on line 481

Jaypan’s picture

As the error in question is completely different from the one posed in the OP, you are best starting off a new topic for it.

I will soon be leaving the Drupal forums permanently. To understand why, please see this thread.

joshf’s picture

I experienced this issue when I was debugging another problem; turns out I had tried to dpm() in a hook_boot() implementation.

Gik000’s picture

In hook boot you don't have dpm (undefined!) ...
let's move it in hook init and try again

Un moscerino nel web

I love PhpStorm

Computer Science is no more about computers than astronomy is about telescopes. Dijkstra