After I installed a quiz module on my Drupal 7 site, it asked me to rebuild permissions. when I try to rebuild it throws this error:

enter image description here

I've tried everything that I found online, including:

  • increasing web server RAM
  • max_execution_time = 1600
  • max_input_time = 180
  • max_input_nesting_level = 300
  • memory_limit = 512M
  • disabling batch mode from node.module core file

nothing seems to work.

There are about 600k records in the node table. I know this is a lot, and probably it causes my issue, but what is the workaround? How can I rebuild permissions with this many nodes easily?

  • Open a JS console when running this. You should get more info as to the error there.
    – Jaypan
    Jul 22, 2019 at 6:53
  • Nothing useful there
    – Dito
    Jul 22, 2019 at 7:24
  • Check your logs then. Drupal, PHP and Apache. Potentially your DB logs as well, though usually DB errors will make themselves known in the PHP logs.
    – Jaypan
    Jul 22, 2019 at 7:25

1 Answer 1


Wherever that "Illegal access" Ajax error comes from, I recommend to rebuild node access from the command line instead. With Drush the following command should do it.

$ drush php-eval 'node_access_rebuild();'

With that many (600k) records in your database it may also be better to have that done by some more advanced process like the one provided by the Node Access Rebuild Progressive module. It also provides its own Drush command.

$ drush node-access-rebuild-progressive


The module works by processing nodes in chunks, from highest node.nid to lowest, until all nodes have been recomputed, storing the last processed nid in a variable (d7) / as state (d8). This ensure no nodes can be skipped, while avoiding having to populate a Queue or other equivalent mechanism, which can be heavy in itself.

  • Finally it reached the end. But it throwed this error: "Processed 1000 of 1000 nodes - Total: 610000/610000 (610024) Processed 24 of 24 nodes - Total: 610024/610024 (610024) PDOStatement::execute(): MySQL server has gone away database.inc:2171^[[1;33;40m^[[1m[warning]^[[0m PDOStatement::execute(): Error reading result set's header ^[[1;33;40m^[[1m[warning]^[[0m dbase.incatabase.inc:2171" and it still says "Illegal Access" :/
    – Dito
    Jul 22, 2019 at 13:51
  • @Dito – Yeah maybe you need to raise MySQL execution time or something like that. Difficult to tell from afar. Seems progressive rebuild is a nice workaround.
    – leymannx
    Jul 22, 2019 at 15:20

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.